Mercurial > hg
comparison hgext/remotefilelog/debugcommands.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 | 2d49482d0dd4 |
children | d55b71393907 |
comparison
equal
deleted
inserted
replaced
46112:d6afa9c149c3 | 46113:59fa3890d40a |
---|---|
7 from __future__ import absolute_import | 7 from __future__ import absolute_import |
8 | 8 |
9 import os | 9 import os |
10 import zlib | 10 import zlib |
11 | 11 |
12 from mercurial.node import bin, hex, nullid, short | 12 from mercurial.node import ( |
13 bin, | |
14 hex, | |
15 nullid, | |
16 short, | |
17 ) | |
13 from mercurial.i18n import _ | 18 from mercurial.i18n import _ |
14 from mercurial.pycompat import open | 19 from mercurial.pycompat import open |
15 from mercurial import ( | 20 from mercurial import ( |
16 error, | 21 error, |
17 filelog, | 22 filelog, |
18 lock as lockmod, | 23 lock as lockmod, |
19 node as nodemod, | |
20 pycompat, | 24 pycompat, |
21 revlog, | 25 revlog, |
22 ) | 26 ) |
23 from mercurial.utils import hashutil | 27 from mercurial.utils import hashutil |
24 from . import ( | 28 from . import ( |
59 queue.append(p2) | 63 queue.append(p2) |
60 | 64 |
61 | 65 |
62 def buildtemprevlog(repo, file): | 66 def buildtemprevlog(repo, file): |
63 # get filename key | 67 # get filename key |
64 filekey = nodemod.hex(hashutil.sha1(file).digest()) | 68 filekey = hex(hashutil.sha1(file).digest()) |
65 filedir = os.path.join(repo.path, b'store/data', filekey) | 69 filedir = os.path.join(repo.path, b'store/data', filekey) |
66 | 70 |
67 # sort all entries based on linkrev | 71 # sort all entries based on linkrev |
68 fctxs = [] | 72 fctxs = [] |
69 for filenode in os.listdir(filedir): | 73 for filenode in os.listdir(filedir): |
419 ui.write( | 423 ui.write( |
420 b"%s %s %s %d\n" | 424 b"%s %s %s %d\n" |
421 % ( | 425 % ( |
422 hashformatter(node), | 426 hashformatter(node), |
423 hashformatter(deltabasenode), | 427 hashformatter(deltabasenode), |
424 nodemod.hex(hashutil.sha1(delta).digest()), | 428 hex(hashutil.sha1(delta).digest()), |
425 len(delta), | 429 len(delta), |
426 ) | 430 ) |
427 ) | 431 ) |
428 | 432 |
429 | 433 |