rebase: add a 'revtodo' constant
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 02 Dec 2014 09:46:20 -0800
changeset 23490 102f144f6e02
parent 23489 fe4157d839ac
child 23491 9972758ab4c5
rebase: add a 'revtodo' constant The state mapping is using '-1' to mark revisions that have not been rebased yet. We introduce and use a constant for that purpose. This will help emphasize the fact the value means something other than nullrev.
hgext/rebase.py
--- a/hgext/rebase.py	Thu Dec 04 07:03:02 2014 -0800
+++ b/hgext/rebase.py	Tue Dec 02 09:46:20 2014 -0800
@@ -23,6 +23,7 @@
 from mercurial.i18n import _
 import os, errno
 
+revtodo = -1
 nullmerge = -2
 revignored = -3
 
@@ -367,7 +368,7 @@
         pos = 0
         for rev in sortedstate:
             pos += 1
-            if state[rev] == -1:
+            if state[rev] == revtodo:
                 ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, repo[rev])),
                             _('changesets'), total)
                 p1, p2, base = defineparents(repo, rev, target, state,
@@ -790,7 +791,7 @@
         if not collapse:
             seen = set([target])
             for old, new in sorted(state.items()):
-                if new != nullrev and new in seen:
+                if new != revtodo and new in seen:
                     skipped.add(old)
                 seen.add(new)
         repo.ui.debug('computed skipped revs: %s\n' %
@@ -882,7 +883,7 @@
                 return None
 
         repo.ui.debug('rebase onto %d starting from %s\n' % (dest, root))
-        state.update(dict.fromkeys(rebaseset, nullrev))
+        state.update(dict.fromkeys(rebaseset, revtodo))
         # Rebase tries to turn <dest> into a parent of <root> while
         # preserving the number of parents of rebased changesets:
         #