Patchwork D2916: rebase: look up commit message to reuse outside of conclude[memory]node()

login
register
mail settings
Submitter phabricator
Date March 21, 2018, 6:11 p.m.
Message ID <differential-rev-PHID-DREV-igrwhgdkbgw5jbx5kypg-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29704/
State Superseded
Headers show

Comments

phabricator - March 21, 2018, 6:11 p.m.
martinvonz created this revision.
martinvonz added a reviewer: phillco.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This was done the same way in both functions, so let's let the single
  caller do it.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -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,17 +1066,15 @@ 
         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.'''
     dsguard = util.nullcontextmanager()
     if not repo.ui.configbool('rebase', 'singletransaction'):
         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: