def makememctx(repo, ctx, revmap, copyfilectxfn):
        parents = newparents(repo, ctx, revmap)
        # Need to make a copy otherwise modification is made on original,
        # which is just plain wrong.
        msg = encoding.fromlocal(ctx.description())
        new_msg, changed = addcommitid(msg, repo=repo)

        memctx = context.memctx(repo, parents,
                                encoding.tolocal(new_msg), ctx.files(),
                                copyfilectxfn, user=ctx.user(),
                      , extra=dict(ctx.extra()))

        return memctx
        def commit(self, *args, **kwargs):
            """Override commit to generate a unique commit identifier.

            The commit identifier is used to track a logical commits across
            history rewrites, including grafting. This is used as an index
            of sorts in the review tool.
            msg = ''
            if args:
                msg = args[0]
            elif kwargs and 'text' in kwargs:
                msg = kwargs['text']
                del kwargs['text']

            if and msg:
                msg, changed = addcommitid(msg, repo=self)

            return super(reviewboardrepo, self).commit(msg, *args[1:], **kwargs)