diff mercurial/obsolete.py @ 46113:59fa3890d40a

node: import symbols explicitly There is no point in lazy importing mercurial.node, it is used all over the place anyway. So consistently import the used symbols directly. Fix one file using symbols indirectly via mercurial.revlog. Differential Revision: https://phab.mercurial-scm.org/D9480
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 01 Dec 2020 21:54:46 +0100
parents 89a2afe31e82
children 6266d19556ad
line wrap: on
line diff
--- a/mercurial/obsolete.py	Sun Dec 13 18:29:22 2020 -0800
+++ b/mercurial/obsolete.py	Tue Dec 01 21:54:46 2020 +0100
@@ -74,10 +74,14 @@
 
 from .i18n import _
 from .pycompat import getattr
+from .node import (
+    bin,
+    hex,
+    nullid,
+)
 from . import (
     encoding,
     error,
-    node,
     obsutil,
     phases,
     policy,
@@ -235,7 +239,7 @@
             parents = ()
         if parents is not None:
             try:
-                parents = tuple(node.bin(p) for p in parents)
+                parents = tuple(bin(p) for p in parents)
                 # if parent content is not a nodeid, drop the data
                 for p in parents:
                     if len(p) != 20:
@@ -262,7 +266,7 @@
             # mark that we explicitly recorded no parents
             metadata[b'p0'] = b''
         for i, p in enumerate(parents, 1):
-            metadata[b'p%i' % i] = node.hex(p)
+            metadata[b'p%i' % i] = hex(p)
     metadata = _fm0encodemeta(metadata)
     numsuc = len(sucs)
     format = _fm0fixed + (_fm0node * numsuc)
@@ -529,7 +533,7 @@
     subtle handling.
     """
     for mark in markers:
-        if node.nullid in mark[1]:
+        if nullid in mark[1]:
             raise error.Abort(
                 _(
                     b'bad obsolescence marker detected: '
@@ -639,7 +643,7 @@
                     raise ValueError(succ)
         if prec in succs:
             raise ValueError(
-                'in-marker cycle with %s' % pycompat.sysstr(node.hex(prec))
+                'in-marker cycle with %s' % pycompat.sysstr(hex(prec))
             )
 
         metadata = tuple(sorted(pycompat.iteritems(metadata)))
@@ -1031,7 +1035,7 @@
         folddigest.update(p.node())
     # Since fold only has to compete against fold for the same successors, it
     # seems fine to use a small ID. Smaller ID save space.
-    return node.hex(folddigest.digest())[:8]
+    return hex(folddigest.digest())[:8]
 
 
 def createmarkers(