D3140: rebase: fix explicit handling of nullid in rebase state
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Apr 5 17:47:12 UTC 2018
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
We used to write a nullid as hex to the rebase state file and
interpret it as the "todo" state (value -1). However, when reading it,
we compared the string value to (binary) nullid, which would of course
not match. AFAICT, it still worked because when the read nodeid did
not match nullid (which, again, it didn't), we'd use the normal path
which did repo[<hex nullid>].rev(), and that also happens to return
-1. It seems to have been this way ever since https://phab.mercurial-scm.org/rHG9972758ab4c5972038a7d0ae740a5d7a7a54e344 (rebase:
handle revtodo as a special value when storing/restoring state,
2014-12-02).
We could just remove it and continue to handle it the way it's always
been done, but it seems better to be explicit.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3140
AFFECTED FILES
hgext/rebase.py
CHANGE DETAILS
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -21,7 +21,7 @@
from mercurial.i18n import _
from mercurial.node import (
- nullid,
+ nullhex,
nullrev,
short,
)
@@ -252,7 +252,7 @@
else:
destrev = legacydest
destmap[oldrev] = destrev
- if newrev in (nullid, revtodostr):
+ if newrev in (nullhex, revtodostr):
state[oldrev] = revtodo
# Legacy compat special case
else:
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list