changeset 37035:b7f5d03e1e54

rebase: look up commit message to reuse outside of conclude[memory]node() This was done the same way in both functions, so let's let the single caller do it. Differential Revision: https://phab.mercurial-scm.org/D2916
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 21 Mar 2018 11:05:32 -0700
parents fbc82a08bdcb
children 0ab0d94ead72
files hgext/rebase.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Wed Mar 21 11:04:13 2018 -0700
+++ b/hgext/rebase.py	Wed Mar 21 11:05:32 2018 -0700
@@ -455,6 +455,8 @@
         Return node of committed revision.'''
         repo = self.repo
         ctx = repo[rev]
+        if commitmsg is None:
+            commitmsg = ctx.description()
         if self.inmemory:
             newnode = concludememorynode(repo, ctx, p1, p2,
                 wctx=self.wctx,
@@ -1030,12 +1032,10 @@
                       ', '.join("%d" % p for p in sorted(parents))))
 
 def concludememorynode(repo, ctx, p1, p2, wctx, editor, extrafn, keepbranches,
-                       date, commitmsg=None):
+                       date, commitmsg):
     '''Commit the memory changes with parents p1 and p2. Reuse commit info from
     ctx but also store useful information in extra.
     Return node of committed revision.'''
-    if commitmsg is None:
-        commitmsg = ctx.description()
     keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
     extra = {'rebase_source': ctx.hex()}
     if extrafn:
@@ -1066,7 +1066,7 @@
         return commitres
 
 def concludenode(repo, ctx, p1, p2, editor, extrafn, keepbranches, date,
-                 commitmsg=None):
+                 commitmsg):
     '''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.'''
@@ -1075,8 +1075,6 @@
         dsguard = dirstateguard.dirstateguard(repo, 'rebase')
     with dsguard:
         repo.setparents(repo[p1].node(), repo[p2].node())
-        if commitmsg is None:
-            commitmsg = ctx.description()
         keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
         extra = {'rebase_source': ctx.hex()}
         if extrafn: