changeset 37036:0ab0d94ead72

rebase: pass in "extra" itself into conclude[memory]node() We were passing in a function instead for no clear reason (probably historical, but I haven't bothered looking). Differential Revision: https://phab.mercurial-scm.org/D2917
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 20 Mar 2018 21:41:53 -0700
parents b7f5d03e1e54
children bd0086bd3af4
files hgext/rebase.py
diffstat 1 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Wed Mar 21 11:05:32 2018 -0700
+++ b/hgext/rebase.py	Tue Mar 20 21:41:53 2018 -0700
@@ -457,10 +457,14 @@
         ctx = repo[rev]
         if commitmsg is None:
             commitmsg = ctx.description()
+        extrafn = _makeextrafn(self.extrafns)
+        extra = {'rebase_source': ctx.hex()}
+        if extrafn:
+            extrafn(ctx, extra)
         if self.inmemory:
             newnode = concludememorynode(repo, ctx, p1, p2,
                 wctx=self.wctx,
-                extrafn=_makeextrafn(self.extrafns),
+                extra=extra,
                 commitmsg=commitmsg,
                 editor=editor,
                 keepbranches=self.keepbranchesf,
@@ -468,7 +472,7 @@
             mergemod.mergestate.clean(repo)
         else:
             newnode = concludenode(repo, ctx, p1, p2,
-                extrafn=_makeextrafn(self.extrafns),
+                extra=extra,
                 commitmsg=commitmsg,
                 editor=editor,
                 keepbranches=self.keepbranchesf,
@@ -1031,15 +1035,12 @@
                      (max(destancestors),
                       ', '.join("%d" % p for p in sorted(parents))))
 
-def concludememorynode(repo, ctx, p1, p2, wctx, editor, extrafn, keepbranches,
+def concludememorynode(repo, ctx, p1, p2, wctx, editor, extra, keepbranches,
                        date, commitmsg):
     '''Commit the memory changes with parents p1 and p2. Reuse commit info from
-    ctx but also store useful information in extra.
+    ctx.
     Return node of committed revision.'''
     keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
-    extra = {'rebase_source': ctx.hex()}
-    if extrafn:
-        extrafn(ctx, extra)
 
     destphase = max(ctx.phase(), phases.draft)
     overrides = {('phases', 'new-commit'): destphase}
@@ -1065,10 +1066,9 @@
         wctx.clean() # Might be reused
         return commitres
 
-def concludenode(repo, ctx, p1, p2, editor, extrafn, keepbranches, date,
+def concludenode(repo, ctx, p1, p2, editor, extra, keepbranches, date,
                  commitmsg):
-    '''Commit the wd changes with parents p1 and p2. Reuse commit info from ctx
-    but also store useful information in extra.
+    '''Commit the wd changes with parents p1 and p2. Reuse commit info from ctx.
     Return node of committed revision.'''
     dsguard = util.nullcontextmanager()
     if not repo.ui.configbool('rebase', 'singletransaction'):
@@ -1076,9 +1076,6 @@
     with dsguard:
         repo.setparents(repo[p1].node(), repo[p2].node())
         keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
-        extra = {'rebase_source': ctx.hex()}
-        if extrafn:
-            extrafn(ctx, extra)
 
         destphase = max(ctx.phase(), phases.draft)
         overrides = {('phases', 'new-commit'): destphase}