diff hgext/git/index.py @ 47012:d55b71393907

node: replace nullid and friends with nodeconstants class The introduction of 256bit hashes require changes to nullid and other constant magic values. Start pushing them down from repository and revlog where sensible. Differential Revision: https://phab.mercurial-scm.org/D9465
author Joerg Sonnenberger <joerg@bec.de>
date Mon, 29 Mar 2021 01:52:06 +0200
parents 59fa3890d40a
children 7431f5ab0d2a
line wrap: on
line diff
--- a/hgext/git/index.py	Mon Apr 19 20:38:52 2021 -0400
+++ b/hgext/git/index.py	Mon Mar 29 01:52:06 2021 +0200
@@ -5,10 +5,7 @@
 import sqlite3
 
 from mercurial.i18n import _
-from mercurial.node import (
-    nullhex,
-    nullid,
-)
+from mercurial.node import sha1nodeconstants
 
 from mercurial import (
     encoding,
@@ -281,7 +278,7 @@
     for pos, commit in enumerate(walker):
         if prog is not None:
             prog.update(pos)
-        p1 = p2 = nullhex
+        p1 = p2 = sha1nodeconstants.nullhex
         if len(commit.parents) > 2:
             raise error.ProgrammingError(
                 (
@@ -318,7 +315,9 @@
                 )
             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 != nullid
+                nf.path: nf.id.hex
+                for nf in new_files
+                if nf.id.raw != sha1nodeconstants.nullid
             }
             for p, n in files.items():
                 # We intentionally set NULLs for any file parentage