Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.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 | ebc6d3484fdd 7711853110b9 |
comparison
equal
deleted
inserted
replaced
46113:d6afa9c149c3 | 46114:59fa3890d40a |
---|---|
40 delattr, | 40 delattr, |
41 getattr, | 41 getattr, |
42 open, | 42 open, |
43 setattr, | 43 setattr, |
44 ) | 44 ) |
45 from .node import hex | |
45 from hgdemandimport import tracing | 46 from hgdemandimport import tracing |
46 from . import ( | 47 from . import ( |
47 encoding, | 48 encoding, |
48 error, | 49 error, |
49 i18n, | 50 i18n, |
50 node as nodemod, | |
51 policy, | 51 policy, |
52 pycompat, | 52 pycompat, |
53 urllibcompat, | 53 urllibcompat, |
54 ) | 54 ) |
55 from .utils import ( | 55 from .utils import ( |
252 h.update(data) | 252 h.update(data) |
253 | 253 |
254 def __getitem__(self, key): | 254 def __getitem__(self, key): |
255 if key not in DIGESTS: | 255 if key not in DIGESTS: |
256 raise error.Abort(_(b'unknown digest type: %s') % k) | 256 raise error.Abort(_(b'unknown digest type: %s') % k) |
257 return nodemod.hex(self._hashes[key].digest()) | 257 return hex(self._hashes[key].digest()) |
258 | 258 |
259 def __iter__(self): | 259 def __iter__(self): |
260 return iter(self._hashes) | 260 return iter(self._hashes) |
261 | 261 |
262 @staticmethod | 262 @staticmethod |