Esempio n. 1
0
    def addcommitid(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.
        extra = dict(ctx.extra())
        assert "commitid" not in extra
        extra["commitid"] = genid(repo)
        memctx = context.memctx(
            repo, parents, ctx.description(), ctx.files(), copyfilectxfn, user=ctx.user(), date=ctx.date(), extra=extra
        )

        return memctx
Esempio n. 2
0
        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.
            """
            # Some callers of commit() may not pass named arguments. Slurp
            # extra from positional arguments.
            if len(args) == 7:
                assert "extra" not in kwargs
                kwargs["extra"] = args[6]
                args = tuple(args[0:6])

            extra = kwargs.setdefault("extra", {})
            if "commitid" not in extra and self.reviews.remoteurl:
                extra["commitid"] = genid(self)

            return super(reviewboardrepo, self).commit(*args, **kwargs)