repo: look up nullrev context by revnum, not symbolic name
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 26 Sep 2018 22:17:34 -0700
changeset 39894 d739f423bf06
parent 39893 f6874567a93b
child 39895 1a184b727aff
repo: look up nullrev context by revnum, not symbolic name I think lookup of the 'null' symbol should be done via scmutil.revsymbol() and repo['null'] is only supported for historical reasons. However, repo[nullrev] is fine, so we can switch to that instead of switching to scmutil.revsymbol('null'). Differential Revision: https://phab.mercurial-scm.org/D4780
mercurial/archival.py
mercurial/scmutil.py
--- a/mercurial/archival.py	Wed Sep 26 22:17:26 2018 -0700
+++ b/mercurial/archival.py	Wed Sep 26 22:17:34 2018 -0700
@@ -16,6 +16,9 @@
 import zlib
 
 from .i18n import _
+from .node import (
+    nullrev,
+)
 
 from . import (
     error,
@@ -76,7 +79,7 @@
     # repo[0] may be hidden
     for rev in repo:
         return repo[rev]
-    return repo['null']
+    return repo[nullrev]
 
 # {tags} on ctx includes local tags and 'tip', with no current way to limit
 # that to global tags.  Therefore, use {latesttag} as a substitute when
--- a/mercurial/scmutil.py	Wed Sep 26 22:17:26 2018 -0700
+++ b/mercurial/scmutil.py	Wed Sep 26 22:17:34 2018 -0700
@@ -21,6 +21,7 @@
     bin,
     hex,
     nullid,
+    nullrev,
     short,
     wdirid,
     wdirrev,
@@ -730,7 +731,7 @@
     if len(parents) > 1:
         return parents
     if repo.ui.debugflag:
-        return [parents[0], repo['null']]
+        return [parents[0], repo[nullrev]]
     if parents[0].rev() >= intrev(ctx) - 1:
         return []
     return parents