Mercurial > hg
comparison hgext/remotefilelog/debugcommands.py @ 40612:3fa4183e7803
py3: use node.hex(h.digest()) instead of h.hexdigest()
hashlib.sha1.hexdigest() returns str on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D5261
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Tue, 13 Nov 2018 18:07:21 +0300 |
parents | 13d4ad8d7801 |
children | aa588bf40a08 |
comparison
equal
deleted
inserted
replaced
40611:5e3b3f88c2e4 | 40612:3fa4183e7803 |
---|---|
13 from mercurial.node import bin, hex, nullid, short | 13 from mercurial.node import bin, hex, nullid, short |
14 from mercurial.i18n import _ | 14 from mercurial.i18n import _ |
15 from mercurial import ( | 15 from mercurial import ( |
16 error, | 16 error, |
17 filelog, | 17 filelog, |
18 node as nodemod, | |
18 revlog, | 19 revlog, |
19 ) | 20 ) |
20 from . import ( | 21 from . import ( |
21 constants, | 22 constants, |
22 datapack, | 23 datapack, |
50 if p2 != nullid: | 51 if p2 != nullid: |
51 queue.append(p2) | 52 queue.append(p2) |
52 | 53 |
53 def buildtemprevlog(repo, file): | 54 def buildtemprevlog(repo, file): |
54 # get filename key | 55 # get filename key |
55 filekey = hashlib.sha1(file).hexdigest() | 56 filekey = nodemod.hex(hashlib.sha1(file).digest()) |
56 filedir = os.path.join(repo.path, 'store/data', filekey) | 57 filedir = os.path.join(repo.path, 'store/data', filekey) |
57 | 58 |
58 # sort all entries based on linkrev | 59 # sort all entries based on linkrev |
59 fctxs = [] | 60 fctxs = [] |
60 for filenode in os.listdir(filedir): | 61 for filenode in os.listdir(filedir): |
342 )) | 343 )) |
343 | 344 |
344 ui.write("%s %s %s %s\n" % ( | 345 ui.write("%s %s %s %s\n" % ( |
345 hashformatter(node), | 346 hashformatter(node), |
346 hashformatter(deltabasenode), | 347 hashformatter(deltabasenode), |
347 hashlib.sha1(delta).hexdigest(), | 348 nodemod.hex(hashlib.sha1(delta).digest()), |
348 len(delta))) | 349 len(delta))) |
349 | 350 |
350 def debughistorypack(ui, path): | 351 def debughistorypack(ui, path): |
351 if '.hist' in path: | 352 if '.hist' in path: |
352 path = path[:path.index('.hist')] | 353 path = path[:path.index('.hist')] |