Patchwork [1,of,4,v2] rebase: clarify naming of variables holding node hashes - don't call them rev

login
register
mail settings
Submitter Mads Kiilerich
Date Dec. 2, 2014, 4:13 a.m.
Message ID <c0ba4e6ab242472c211f.1417493626@localhost.localdomain>
Download mbox | patch
Permalink /patch/6937/
State Accepted
Commit 2e047b1558a5ba399c18b24df4833d1b1bacabe6
Headers show

Comments

Mads Kiilerich - Dec. 2, 2014, 4:13 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1417493573 -3600
#      Tue Dec 02 05:12:53 2014 +0100
# Node ID c0ba4e6ab242472c211f7233e14da65db855061a
# Parent  19ebd2f88fc77282efe724b30de8750f79771e8f
rebase: clarify naming of variables holding node hashes - don't call them rev

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -392,17 +392,17 @@  def rebase(ui, repo, **opts):
                     merging = repo[p2].rev() != nullrev
                     editform = cmdutil.mergeeditform(merging, 'rebase')
                     editor = cmdutil.getcommiteditor(editform=editform, **opts)
-                    newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn,
-                                          editor=editor)
+                    newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
+                                           editor=editor)
                 else:
                     # Skip commit if we are collapsing
                     repo.dirstate.beginparentchange()
                     repo.setparents(repo[p1].node())
                     repo.dirstate.endparentchange()
-                    newrev = None
+                    newnode = None
                 # Update the state
-                if newrev is not None:
-                    state[rev] = repo[newrev].rev()
+                if newnode is not None:
+                    state[rev] = repo[newnode].rev()
                 else:
                     if not collapsef:
                         ui.note(_('no changes, revision %d skipped\n') % rev)
@@ -427,11 +427,11 @@  def rebase(ui, repo, **opts):
                         commitmsg += '\n* %s' % repo[rebased].description()
                 editopt = True
             editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
-            newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
-                                  extrafn=extrafn, editor=editor)
+            newnode = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
+                                   extrafn=extrafn, editor=editor)
             for oldrev in state.iterkeys():
                 if state[oldrev] > nullmerge:
-                    state[oldrev] = newrev
+                    state[oldrev] = newnode
 
         if 'qtip' in repo.tags():
             updatemq(repo, state, skipped, **opts)
@@ -456,7 +456,7 @@  def rebase(ui, repo, **opts):
         if not keepf:
             collapsedas = None
             if collapsef:
-                collapsedas = newrev
+                collapsedas = newnode
             clearrebased(ui, repo, state, skipped, collapsedas)
 
         if currentbookmarks:
@@ -502,7 +502,8 @@  def externalparent(repo, state, targetan
                       ', '.join(str(p) for p in sorted(parents))))
 
 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None):
-    'Commit the changes and store useful information in extra'
+    '''Commit the changes and store useful information in extra.
+    Return node of committed revision.'''
     try:
         repo.dirstate.beginparentchange()
         repo.setparents(repo[p1].node(), repo[p2].node())
@@ -519,13 +520,13 @@  def concludenode(repo, rev, p1, p2, comm
             targetphase = max(ctx.phase(), phases.draft)
             repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase')
             # Commit might fail if unresolved files exist
-            newrev = repo.commit(text=commitmsg, user=ctx.user(),
-                                 date=ctx.date(), extra=extra, editor=editor)
+            newnode = repo.commit(text=commitmsg, user=ctx.user(),
+                                  date=ctx.date(), extra=extra, editor=editor)
         finally:
             repo.ui.restoreconfig(backup)
 
-        repo.dirstate.setbranch(repo[newrev].branch())
-        return newrev
+        repo.dirstate.setbranch(repo[newnode].branch())
+        return newnode
     except util.Abort:
         # Invalidate the previous setparents
         repo.dirstate.invalidate()