changeset 37039:7616073a4cf1

rebase: pass in entire "overrides" dict to conclude[memory]node() As with previous patches, this was done the same way in both functions, so let's make the caller do it instead. Differential Revision: https://phab.mercurial-scm.org/D2920
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 20 Mar 2018 21:53:36 -0700
parents 7db86856f27f
children b8d305bd12ca
files hgext/rebase.py
diffstat 1 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Tue Mar 20 21:49:09 2018 -0700
+++ b/hgext/rebase.py	Tue Mar 20 21:53:36 2018 -0700
@@ -450,13 +450,17 @@
         for c in self.extrafns:
             c(ctx, extra)
         keepbranch = self.keepbranchesf and repo[p1].branch() != ctx.branch()
+        destphase = max(ctx.phase(), phases.draft)
+        overrides = {('phases', 'new-commit'): destphase}
+        if keepbranch:
+            overrides[('ui', 'allowemptycommit')] = True
         if self.inmemory:
             newnode = concludememorynode(repo, ctx, p1, p2,
                 wctx=self.wctx,
                 extra=extra,
                 commitmsg=commitmsg,
                 editor=editor,
-                keepbranch=keepbranch,
+                overrides=overrides,
                 date=self.date)
             mergemod.mergestate.clean(repo)
         else:
@@ -464,7 +468,7 @@
                 extra=extra,
                 commitmsg=commitmsg,
                 editor=editor,
-                keepbranch=keepbranch,
+                overrides=overrides,
                 date=self.date)
 
         if newnode is None:
@@ -1024,15 +1028,11 @@
                      (max(destancestors),
                       ', '.join("%d" % p for p in sorted(parents))))
 
-def concludememorynode(repo, ctx, p1, p2, wctx, editor, extra, keepbranch,
-                       date, commitmsg):
+def concludememorynode(repo, ctx, p1, p2, wctx, editor, extra, overrides, date,
+                       commitmsg):
     '''Commit the memory changes with parents p1 and p2. Reuse commit info from
     ctx.
     Return node of committed revision.'''
-    destphase = max(ctx.phase(), phases.draft)
-    overrides = {('phases', 'new-commit'): destphase}
-    if keepbranch:
-        overrides[('ui', 'allowemptycommit')] = True
     with repo.ui.configoverride(overrides, 'rebase'):
         # Replicates the empty check in ``repo.commit``.
         if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
@@ -1053,7 +1053,7 @@
         wctx.clean() # Might be reused
         return commitres
 
-def concludenode(repo, ctx, p1, p2, editor, extra, keepbranch, date,
+def concludenode(repo, ctx, p1, p2, editor, extra, overrides, date,
                  commitmsg):
     '''Commit the wd changes with parents p1 and p2. Reuse commit info from ctx.
     Return node of committed revision.'''
@@ -1063,10 +1063,6 @@
     with dsguard:
         repo.setparents(repo[p1].node(), repo[p2].node())
 
-        destphase = max(ctx.phase(), phases.draft)
-        overrides = {('phases', 'new-commit'): destphase}
-        if keepbranch:
-            overrides[('ui', 'allowemptycommit')] = True
         with repo.ui.configoverride(overrides, 'rebase'):
             # Commit might fail if unresolved files exist
             if date is None: