Mercurial > hg
diff hgext/convert/git.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 | 8ff1ecfadcd1 |
children | f7621fa14b84 |
line wrap: on
line diff
--- a/hgext/convert/git.py Sun Dec 13 18:29:22 2020 -0800 +++ b/hgext/convert/git.py Tue Dec 01 21:54:46 2020 +0100 @@ -9,10 +9,10 @@ import os from mercurial.i18n import _ +from mercurial.node import nullhex from mercurial import ( config, error, - node as nodemod, pycompat, ) @@ -192,7 +192,7 @@ return heads def catfile(self, rev, ftype): - if rev == nodemod.nullhex: + if rev == nullhex: raise IOError self.catfilepipe[0].write(rev + b'\n') self.catfilepipe[0].flush() @@ -214,7 +214,7 @@ return data def getfile(self, name, rev): - if rev == nodemod.nullhex: + if rev == nullhex: return None, None if name == b'.hgsub': data = b'\n'.join([m.hgsub() for m in self.submoditer()]) @@ -228,7 +228,7 @@ return data, mode def submoditer(self): - null = nodemod.nullhex + null = nullhex for m in sorted(self.submodules, key=lambda p: p.path): if m.node != null: yield m @@ -316,7 +316,7 @@ subexists[0] = True if entry[4] == b'D' or renamesource: subdeleted[0] = True - changes.append((b'.hgsub', nodemod.nullhex)) + changes.append((b'.hgsub', nullhex)) else: changes.append((b'.hgsub', b'')) elif entry[1] == b'160000' or entry[0] == b':160000': @@ -324,7 +324,7 @@ subexists[0] = True else: if renamesource: - h = nodemod.nullhex + h = nullhex self.modecache[(f, h)] = (p and b"x") or (s and b"l") or b"" changes.append((f, h)) @@ -361,7 +361,7 @@ if subexists[0]: if subdeleted[0]: - changes.append((b'.hgsubstate', nodemod.nullhex)) + changes.append((b'.hgsubstate', nullhex)) else: self.retrievegitmodules(version) changes.append((b'.hgsubstate', b''))