Mercurial > public > mercurial-scm > hg-stable
diff mercurial/subrepo.py @ 46114: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 | d6601547f22b a4c19a162615 |
line wrap: on
line diff
--- a/mercurial/subrepo.py Sun Dec 13 18:29:22 2020 -0800 +++ b/mercurial/subrepo.py Tue Dec 01 21:54:46 2020 +0100 @@ -18,6 +18,12 @@ import xml.dom.minidom from .i18n import _ +from .node import ( + bin, + hex, + nullid, + short, +) from . import ( cmdutil, encoding, @@ -26,7 +32,6 @@ logcmdutil, match as matchmod, merge as merge, - node, pathutil, phases, pycompat, @@ -61,7 +66,7 @@ def _getstorehashcachename(remotepath): '''get a unique filename for the store hash cache of a remote repository''' - return node.hex(hashutil.sha1(_expandedabspath(remotepath)).digest())[0:12] + return hex(hashutil.sha1(_expandedabspath(remotepath)).digest())[0:12] class SubrepoAbort(error.Abort): @@ -508,7 +513,7 @@ yield b'# %s\n' % _expandedabspath(remotepath) vfs = self._repo.vfs for relname in filelist: - filehash = node.hex(hashutil.sha1(vfs.tryread(relname)).digest()) + filehash = hex(hashutil.sha1(vfs.tryread(relname)).digest()) yield b'%s = %s\n' % (relname, filehash) @propertycache @@ -601,11 +606,11 @@ @annotatesubrepoerror def diff(self, ui, diffopts, node2, match, prefix, **opts): try: - node1 = node.bin(self._state[1]) + node1 = bin(self._state[1]) # We currently expect node2 to come from substate and be # in hex format if node2 is not None: - node2 = node.bin(node2) + node2 = bin(node2) logcmdutil.diffordiffstat( ui, self._repo, @@ -669,7 +674,7 @@ n = self._repo.commit(text, user, date) if not n: return self._repo[b'.'].hex() # different version checked out - return node.hex(n) + return hex(n) @annotatesubrepoerror def phase(self, state): @@ -680,7 +685,7 @@ # we can't fully delete the repository as it may contain # local-only history self.ui.note(_(b'removing subrepo %s\n') % subrelpath(self)) - hg.clean(self._repo, node.nullid, False) + hg.clean(self._repo, nullid, False) def _get(self, state): source, revision, kind = state @@ -1019,7 +1024,7 @@ # explicit warning. msg = _(b"subrepo '%s' is hidden in revision %s") % ( self._relpath, - node.short(self._ctx.node()), + short(self._ctx.node()), ) if onpush: @@ -1032,7 +1037,7 @@ # don't treat this as an error for `hg verify`. msg = _(b"subrepo '%s' not found in revision %s") % ( self._relpath, - node.short(self._ctx.node()), + short(self._ctx.node()), ) if onpush: