Patchwork D3140: rebase: fix explicit handling of nullid in rebase state

login
register
mail settings
Submitter phabricator
Date April 5, 2018, 5:47 p.m.
Message ID <differential-rev-PHID-DREV-ozf42klfgxtojec5mzmm-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30394/
State Superseded
Headers show

Comments

phabricator - April 5, 2018, 5:47 p.m.
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




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - April 5, 2018, 5:55 p.m.
quark accepted this revision.
quark added a comment.


  Hmm... maybe just remove it.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3140

To: martinvonz, #hg-reviewers, quark
Cc: quark, mercurial-devel
phabricator - April 5, 2018, 6:02 p.m.
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D3140#50376, @quark wrote:
  
  > Hmm... maybe just remove it.
  
  
  Done.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3140

To: martinvonz, #hg-reviewers, quark
Cc: quark, mercurial-devel

Patch

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: