rebase: pass in "user" instead of "ctx" to conclude[memory]node()
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 20 Mar 2018 22:11:10 -0700
changeset 37042 8ff5772711fa
parent 37041 0b1230a5a958
child 37043 a8d8cdafe29c
rebase: pass in "user" instead of "ctx" to conclude[memory]node() This was the only remaining part of the context object that was needed. Differential Revision: https://phab.mercurial-scm.org/D2923
hgext/rebase.py
--- a/hgext/rebase.py	Tue Mar 20 21:59:04 2018 -0700
+++ b/hgext/rebase.py	Tue Mar 20 22:11:10 2018 -0700
@@ -459,18 +459,20 @@
             overrides[('ui', 'allowemptycommit')] = True
         with repo.ui.configoverride(overrides, 'rebase'):
             if self.inmemory:
-                newnode = concludememorynode(repo, ctx, p1, p2,
+                newnode = concludememorynode(repo, p1, p2,
                     wctx=self.wctx,
                     extra=extra,
                     commitmsg=commitmsg,
                     editor=editor,
+                    user=ctx.user(),
                     date=date)
                 mergemod.mergestate.clean(repo)
             else:
-                newnode = concludenode(repo, ctx, p1, p2,
+                newnode = concludenode(repo, p1, p2,
                     extra=extra,
                     commitmsg=commitmsg,
                     editor=editor,
+                    user=ctx.user(),
                     date=date)
 
             if newnode is None:
@@ -1030,9 +1032,9 @@
                      (max(destancestors),
                       ', '.join("%d" % p for p in sorted(parents))))
 
-def concludememorynode(repo, ctx, p1, p2, wctx, editor, extra, date, commitmsg):
-    '''Commit the memory changes with parents p1 and p2. Reuse commit info from
-    ctx.
+def concludememorynode(repo, p1, p2, wctx, editor, extra, user, date,
+                       commitmsg):
+    '''Commit the memory changes with parents p1 and p2.
     Return node of committed revision.'''
     # Replicates the empty check in ``repo.commit``.
     if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
@@ -1045,13 +1047,13 @@
         branch = extra['branch']
 
     memctx = wctx.tomemctx(commitmsg, parents=(p1, p2), date=date,
-        extra=extra, user=ctx.user(), branch=branch, editor=editor)
+        extra=extra, user=user, branch=branch, editor=editor)
     commitres = repo.commitctx(memctx)
     wctx.clean() # Might be reused
     return commitres
 
-def concludenode(repo, ctx, p1, p2, editor, extra, date, commitmsg):
-    '''Commit the wd changes with parents p1 and p2. Reuse commit info from ctx.
+def concludenode(repo, p1, p2, editor, extra, user, date, commitmsg):
+    '''Commit the wd changes with parents p1 and p2.
     Return node of committed revision.'''
     dsguard = util.nullcontextmanager()
     if not repo.ui.configbool('rebase', 'singletransaction'):
@@ -1060,8 +1062,8 @@
         repo.setparents(repo[p1].node(), repo[p2].node())
 
         # Commit might fail if unresolved files exist
-        newnode = repo.commit(text=commitmsg, user=ctx.user(),
-                              date=date, extra=extra, editor=editor)
+        newnode = repo.commit(text=commitmsg, user=user, date=date,
+                              extra=extra, editor=editor)
 
         repo.dirstate.setbranch(repo[newnode].branch())
         return newnode