# HG changeset patch # User Martin von Zweigbergk # Date 2018-03-21 18:04:13 # Node ID fbc82a08bdcb90ae01ce7fd26d8ac860740d1487 # Parent 5f99142f59ccca1422d7d66769067b28cebfce53 rebase: pass in ctx, not rev, to conclude[memory]node() They both need it and there's no locking that might make the results different, so let's do it in one place. This also lets us move out more common code in the following patches. Differential Revision: https://phab.mercurial-scm.org/D2915 diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -454,8 +454,9 @@ class rebaseruntime(object): Reuse commit info from rev but also store useful information in extra. Return node of committed revision.''' repo = self.repo + ctx = repo[rev] if self.inmemory: - newnode = concludememorynode(repo, rev, p1, p2, + newnode = concludememorynode(repo, ctx, p1, p2, wctx=self.wctx, extrafn=_makeextrafn(self.extrafns), commitmsg=commitmsg, @@ -464,7 +465,7 @@ class rebaseruntime(object): date=self.date) mergemod.mergestate.clean(repo) else: - newnode = concludenode(repo, rev, p1, p2, + newnode = concludenode(repo, ctx, p1, p2, extrafn=_makeextrafn(self.extrafns), commitmsg=commitmsg, editor=editor, @@ -1028,12 +1029,11 @@ def externalparent(repo, state, destance (max(destancestors), ', '.join("%d" % p for p in sorted(parents)))) -def concludememorynode(repo, rev, p1, p2, wctx, editor, extrafn, keepbranches, +def concludememorynode(repo, ctx, p1, p2, wctx, editor, extrafn, keepbranches, date, commitmsg=None): '''Commit the memory changes with parents p1 and p2. Reuse commit info from - rev but also store useful information in extra. + ctx but also store useful information in extra. Return node of committed revision.''' - ctx = repo[rev] if commitmsg is None: commitmsg = ctx.description() keepbranch = keepbranches and repo[p1].branch() != ctx.branch() @@ -1065,9 +1065,9 @@ def concludememorynode(repo, rev, p1, p2 wctx.clean() # Might be reused return commitres -def concludenode(repo, rev, p1, p2, editor, extrafn, keepbranches, date, +def concludenode(repo, ctx, p1, p2, editor, extrafn, keepbranches, date, commitmsg=None): - '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev + '''Commit the wd changes with parents p1 and p2. Reuse commit info from ctx but also store useful information in extra. Return node of committed revision.''' dsguard = util.nullcontextmanager() @@ -1075,7 +1075,6 @@ def concludenode(repo, rev, p1, p2, edit dsguard = dirstateguard.dirstateguard(repo, 'rebase') with dsguard: repo.setparents(repo[p1].node(), repo[p2].node()) - ctx = repo[rev] if commitmsg is None: commitmsg = ctx.description() keepbranch = keepbranches and repo[p1].branch() != ctx.branch()