diff hgext/git/index.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 83e41b73d115
children d55b71393907 de26b9a7ec29
line wrap: on
line diff
--- a/hgext/git/index.py	Sun Dec 13 18:29:22 2020 -0800
+++ b/hgext/git/index.py	Tue Dec 01 21:54:46 2020 +0100
@@ -5,11 +5,14 @@
 import sqlite3
 
 from mercurial.i18n import _
+from mercurial.node import (
+    nullhex,
+    nullid,
+)
 
 from mercurial import (
     encoding,
     error,
-    node as nodemod,
     pycompat,
 )
 
@@ -278,7 +281,7 @@
     for pos, commit in enumerate(walker):
         if prog is not None:
             prog.update(pos)
-        p1 = p2 = nodemod.nullhex
+        p1 = p2 = nullhex
         if len(commit.parents) > 2:
             raise error.ProgrammingError(
                 (
@@ -315,9 +318,7 @@
                 )
             new_files = (p.delta.new_file for p in patchgen)
             files = {
-                nf.path: nf.id.hex
-                for nf in new_files
-                if nf.id.raw != nodemod.nullid
+                nf.path: nf.id.hex for nf in new_files if nf.id.raw != nullid
             }
             for p, n in files.items():
                 # We intentionally set NULLs for any file parentage