Patchwork D2915: rebase: pass in ctx, not rev, to conclude[memory]node()

login
register
mail settings
Submitter phabricator
Date March 21, 2018, 11:45 p.m.
Message ID <ca67f9ea3bd635c0bff3f9c71818538d@localhost.localdomain>
Download mbox | patch
Permalink /patch/29733/
State Not Applicable
Headers show

Comments

phabricator - March 21, 2018, 11:45 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfbc82a08bdcb: rebase: pass in ctx, not rev, to conclude[memory]node() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2915?vs=7178&id=7207

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -454,17 +454,18 @@ 
         Reuse commit info from rev but also store useful information in extra.
         Return node of committed revision.'''
         repo = self.repo
+        ctx = repo[rev]
         if self.inmemory:
-            newnode = concludememorynode(repo, rev, p1, p2,
+            newnode = concludememorynode(repo, ctx, p1, p2,
                 wctx=self.wctx,
                 extrafn=_makeextrafn(self.extrafns),
                 commitmsg=commitmsg,
                 editor=editor,
                 keepbranches=self.keepbranchesf,
                 date=self.date)
             mergemod.mergestate.clean(repo)
         else:
-            newnode = concludenode(repo, rev, p1, p2,
+            newnode = concludenode(repo, ctx, p1, p2,
                 extrafn=_makeextrafn(self.extrafns),
                 commitmsg=commitmsg,
                 editor=editor,
@@ -1028,12 +1029,11 @@ 
                      (max(destancestors),
                       ', '.join("%d" % p for p in sorted(parents))))
 
-def concludememorynode(repo, rev, p1, p2, wctx, editor, extrafn, keepbranches,
+def concludememorynode(repo, ctx, p1, p2, wctx, editor, extrafn, keepbranches,
                        date, commitmsg=None):
     '''Commit the memory changes with parents p1 and p2. Reuse commit info from
-    rev but also store useful information in extra.
+    ctx but also store useful information in extra.
     Return node of committed revision.'''
-    ctx = repo[rev]
     if commitmsg is None:
         commitmsg = ctx.description()
     keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
@@ -1065,17 +1065,16 @@ 
         wctx.clean() # Might be reused
         return commitres
 
-def concludenode(repo, rev, p1, p2, editor, extrafn, keepbranches, date,
+def concludenode(repo, ctx, p1, p2, editor, extrafn, keepbranches, date,
                  commitmsg=None):
-    '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev
+    '''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())
-        ctx = repo[rev]
         if commitmsg is None:
             commitmsg = ctx.description()
         keepbranch = keepbranches and repo[p1].branch() != ctx.branch()