Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlogutils/nodemap.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 | 8ff2d8359d0f |
children | 8e7ce6555ea7 |
line wrap: on
line diff
--- a/mercurial/revlogutils/nodemap.py Sun Dec 13 18:29:22 2020 -0800 +++ b/mercurial/revlogutils/nodemap.py Tue Dec 01 21:54:46 2020 +0100 @@ -14,10 +14,10 @@ import struct from ..i18n import _ +from ..node import hex from .. import ( error, - node as nodemod, util, ) @@ -278,7 +278,7 @@ """return a new unique identifier. The identifier is random and composed of ascii characters.""" - return nodemod.hex(os.urandom(ID_SIZE)) + return hex(os.urandom(ID_SIZE)) class NodeMapDocket(object): @@ -461,8 +461,8 @@ """ root = Block() for rev in range(len(index)): - hex = nodemod.hex(index[rev][7]) - _insert_into_block(index, 0, root, rev, hex) + current_hex = hex(index[rev][7]) + _insert_into_block(index, 0, root, rev, current_hex) return root @@ -470,8 +470,8 @@ """consume""" changed = 0 for rev in range(last_rev + 1, len(index)): - hex = nodemod.hex(index[rev][7]) - changed += _insert_into_block(index, 0, root, rev, hex) + current_hex = hex(index[rev][7]) + changed += _insert_into_block(index, 0, root, rev, current_hex) return changed, root @@ -500,7 +500,7 @@ else: # collision with a previously unique prefix, inserting new # vertices to fit both entry. - other_hex = nodemod.hex(index[entry][7]) + other_hex = hex(index[entry][7]) other_rev = entry new = Block() block[hex_digit] = new @@ -604,7 +604,7 @@ ret = 1 else: all_revs.remove(r) - nm_rev = _find_node(root, nodemod.hex(index[r][7])) + nm_rev = _find_node(root, hex(index[r][7])) if nm_rev is None: msg = b" revision node does not match any entries: %d\n" % r ui.write_err(msg)