histedit: rename `tip` to `topmost`
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 26 Sep 2012 18:13:00 +0200
changeset 17665 b65533958b85
parent 17664 4eb13b619785
child 17666 5b6c8f2fbda5
histedit: rename `tip` to `topmost` I expected `tip` to be repo's tip when it was the rewritten set tip. I rename the variable to the less ambiguous `topmost`.
hgext/histedit.py
--- a/hgext/histedit.py	Wed Sep 26 14:46:08 2012 +0200
+++ b/hgext/histedit.py	Wed Sep 26 18:13:00 2012 +0200
@@ -417,8 +417,8 @@
     if opts.get('continue', False):
         if len(parent) != 0:
             raise util.Abort(_('no arguments allowed with --continue'))
-        (parentctxnode, created, replaced,
-         tmpnodes, existing, rules, keep, tip, replacemap) = readstate(repo)
+        (parentctxnode, created, replaced, tmpnodes,
+         existing, rules, keep, topmost, replacemap) = readstate(repo)
         currentparent, wantnull = repo.dirstate.parents()
         parentctx = repo[parentctxnode]
         # existing is the list of revisions initially considered by
@@ -479,9 +479,9 @@
         if len(parent) != 0:
             raise util.Abort(_('no arguments allowed with --abort'))
         (parentctxnode, created, replaced, tmpnodes,
-         existing, rules, keep, tip, replacemap) = readstate(repo)
-        ui.debug('restore wc to old tip %s\n' % node.hex(tip))
-        hg.clean(repo, tip)
+         existing, rules, keep, topmost, replacemap) = readstate(repo)
+        ui.debug('restore wc to old parent %s\n' % node.short(topmost))
+        hg.clean(repo, topmost)
         cleanupnode(ui, repo, 'created', created)
         cleanupnode(ui, repo, 'temp', tmpnodes)
         os.unlink(os.path.join(repo.path, 'histedit-state'))
@@ -492,7 +492,7 @@
             raise util.Abort(_('history edit already in progress, try '
                                '--continue or --abort'))
 
-        tip, empty = repo.dirstate.parents()
+        topmost, empty = repo.dirstate.parents()
 
 
         if len(parent) != 1:
@@ -500,7 +500,7 @@
         parent = scmutil.revsingle(repo, parent[0]).node()
 
         keep = opts.get('keep', False)
-        revs = between(repo, parent, tip, keep)
+        revs = between(repo, parent, topmost, keep)
 
         ctxs = [repo[r] for r in revs]
         existing = [r.node() for r in ctxs]
@@ -508,7 +508,7 @@
         if not rules:
             rules = '\n'.join([makedesc(c) for c in ctxs])
             rules += '\n\n'
-            rules += editcomment % (node.short(parent), node.short(tip))
+            rules += editcomment % (node.short(parent), node.short(topmost))
             rules = ui.edit(rules, ui.username())
             # Save edit rules in .hg/histedit-last-edit.txt in case
             # the user needs to ask for help after something
@@ -534,7 +534,7 @@
 
     while rules:
         writestate(repo, parentctx.node(), created, replaced,
-                   tmpnodes, existing, rules, keep, tip, replacemap)
+                   tmpnodes, existing, rules, keep, topmost, replacemap)
         action, ha = rules.pop(0)
         ui.debug('histedit: processing %s %s\n' % (action, ha))
         (parentctx, created_, replaced_, tmpnodes_) = actiontable[action](
@@ -622,16 +622,16 @@
 
 
 def writestate(repo, parentctxnode, created, replaced,
-               tmpnodes, existing, rules, keep, oldtip, replacemap):
+               tmpnodes, existing, rules, keep, topmost, replacemap):
     fp = open(os.path.join(repo.path, 'histedit-state'), 'w')
     pickle.dump((parentctxnode, created, replaced,
-                 tmpnodes, existing, rules, keep, oldtip, replacemap),
+                 tmpnodes, existing, rules, keep, topmost, replacemap),
                 fp)
     fp.close()
 
 def readstate(repo):
     """Returns a tuple of (parentnode, created, replaced, tmp, existing, rules,
-                           keep, oldtip, replacemap ).
+                           keep, topmost, replacemap ).
     """
     fp = open(os.path.join(repo.path, 'histedit-state'))
     return pickle.load(fp)