D2920: rebase: pass in entire "overrides" dict to conclude[memory]node()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Mar 21 18:11:21 UTC 2018


martinvonz created this revision.
martinvonz added a reviewer: phillco.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As with previous patches, this was done the same way in both
  functions, so let's make the caller do it instead.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2920

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -450,21 +450,25 @@
         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:
             newnode = concludenode(repo, ctx, p1, p2,
                 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:



To: martinvonz, phillco, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list