Mercurial > public > mercurial-scm > hg
diff hgext/lfs/blobstore.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 | 89a2afe31e82 |
children | ffd3e823a7e5 |
line wrap: on
line diff
--- a/hgext/lfs/blobstore.py Sun Dec 13 18:29:22 2020 -0800 +++ b/hgext/lfs/blobstore.py Tue Dec 01 21:54:46 2020 +0100 @@ -17,12 +17,12 @@ from mercurial.i18n import _ from mercurial.pycompat import getattr +from mercurial.node import hex from mercurial import ( encoding, error, httpconnection as httpconnectionmod, - node, pathutil, pycompat, url as urlmod, @@ -173,7 +173,7 @@ ) raise LfsRemoteError(_(msg) % (size, int(content_length))) - realoid = node.hex(sha256.digest()) + realoid = hex(sha256.digest()) if realoid != oid: raise LfsCorruptionError( _(b'corrupt remote lfs object: %s') % oid @@ -224,7 +224,7 @@ # Don't abort if corruption is detected, because `hg verify` will # give more useful info about the corruption- simply don't add the # hardlink. - if verify or node.hex(hashlib.sha256(blob).digest()) == oid: + if verify or hex(hashlib.sha256(blob).digest()) == oid: self.ui.note(_(b'lfs: found %s in the usercache\n') % oid) lfutil.link(self.cachevfs.join(oid), self.vfs.join(oid)) else: @@ -248,7 +248,7 @@ for chunk in util.filechunkiter(fp, size=1048576): sha256.update(chunk) - return oid == node.hex(sha256.digest()) + return oid == hex(sha256.digest()) def has(self, oid): """Returns True if the local blobstore contains the requested blob, @@ -706,7 +706,7 @@ def _verify(oid, content): - realoid = node.hex(hashlib.sha256(content).digest()) + realoid = hex(hashlib.sha256(content).digest()) if realoid != oid: raise LfsCorruptionError( _(b'detected corrupt lfs object: %s') % oid,