diff mercurial/copies.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 2f357d053df2
children 70a9eb899637
line wrap: on
line diff
--- a/mercurial/copies.py	Sun Dec 13 18:29:22 2020 -0800
+++ b/mercurial/copies.py	Tue Dec 01 21:54:46 2020 +0100
@@ -11,11 +11,13 @@
 import os
 
 from .i18n import _
-
+from .node import (
+    nullid,
+    nullrev,
+)
 
 from . import (
     match as matchmod,
-    node,
     pathutil,
     policy,
     pycompat,
@@ -147,7 +149,7 @@
     # optimization, since the ctx.files() for a merge commit is not correct for
     # this comparison.
     forwardmissingmatch = match
-    if b.p1() == a and b.p2().node() == node.nullid:
+    if b.p1() == a and b.p2().node() == nullid:
         filesmatcher = matchmod.exact(b.files())
         forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher)
     missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
@@ -233,7 +235,7 @@
             else:
                 raw = None
             value = (p1, p2, raw)
-            if p1 != node.nullrev and p2 != node.nullrev:
+            if p1 != nullrev and p2 != nullrev:
                 # XXX some case we over cache, IGNORE
                 merge_caches[rev] = value
             return value
@@ -250,7 +252,7 @@
             if flags(rev) & HASCOPIESINFO:
                 changes = changelogrevision(rev).changes
             value = (p1, p2, changes)
-            if p1 != node.nullrev and p2 != node.nullrev:
+            if p1 != nullrev and p2 != nullrev:
                 # XXX some case we over cache, IGNORE
                 merge_caches[rev] = value
             return value
@@ -277,7 +279,7 @@
 
 
 def _changesetforwardcopies(a, b, match):
-    if a.rev() in (node.nullrev, b.rev()):
+    if a.rev() in (nullrev, b.rev()):
         return {}
 
     repo = a.repo().unfiltered()
@@ -290,7 +292,7 @@
     roots = set()
     for r in missingrevs:
         for p in cl.parentrevs(r):
-            if p == node.nullrev:
+            if p == nullrev:
                 continue
             if p not in children:
                 children[p] = [r]
@@ -494,7 +496,7 @@
             parents = fctx._filelog.parents(fctx._filenode)
             nb_parents = 0
             for n in parents:
-                if n != node.nullid:
+                if n != nullid:
                     nb_parents += 1
             return nb_parents >= 2
 
@@ -668,7 +670,7 @@
         if debug:
             repo.ui.debug(b'debug.copies: search mode: combined\n')
         base = None
-        if a.rev() != node.nullrev:
+        if a.rev() != nullrev:
             base = x
         copies = _chain(
             _backwardrenames(x, a, match=match),