Show More
@@ -55,6 +55,7 b' from . import (' | |||||
55 | encoding, |
|
55 | encoding, | |
56 | error, |
|
56 | error, | |
57 | extensions, |
|
57 | extensions, | |
|
58 | node, | |||
58 | pycompat, |
|
59 | pycompat, | |
59 | util, |
|
60 | util, | |
60 | ) |
|
61 | ) | |
@@ -63,7 +64,7 b' from . import (' | |||||
63 |
|
64 | |||
64 | def _hashlist(items): |
|
65 | def _hashlist(items): | |
65 | """return sha1 hexdigest for a list""" |
|
66 | """return sha1 hexdigest for a list""" | |
66 |
return hashlib.sha1(str(items)). |
|
67 | return node.hex(hashlib.sha1(str(items)).digest()) | |
67 |
|
68 | |||
68 | # sensitive config sections affecting confighash |
|
69 | # sensitive config sections affecting confighash | |
69 | _configsections = [ |
|
70 | _configsections = [ |
@@ -569,7 +569,7 b' def clone(ui, peeropts, source, dest=Non' | |||||
569 | 'unable to resolve identity of remote)\n')) |
|
569 | 'unable to resolve identity of remote)\n')) | |
570 | elif sharenamemode == 'remote': |
|
570 | elif sharenamemode == 'remote': | |
571 | sharepath = os.path.join( |
|
571 | sharepath = os.path.join( | |
572 |
sharepool, hashlib.sha1(source). |
|
572 | sharepool, node.hex(hashlib.sha1(source).digest())) | |
573 | else: |
|
573 | else: | |
574 | raise error.Abort(_('unknown share naming mode: %s') % |
|
574 | raise error.Abort(_('unknown share naming mode: %s') % | |
575 | sharenamemode) |
|
575 | sharenamemode) |
@@ -92,6 +92,7 b' import threading' | |||||
92 |
|
92 | |||
93 | from .i18n import _ |
|
93 | from .i18n import _ | |
94 | from . import ( |
|
94 | from . import ( | |
|
95 | node, | |||
95 | pycompat, |
|
96 | pycompat, | |
96 | urllibcompat, |
|
97 | urllibcompat, | |
97 | util, |
|
98 | util, | |
@@ -607,7 +608,7 b' def continuity(url):' | |||||
607 | foo = fo.read() |
|
608 | foo = fo.read() | |
608 | fo.close() |
|
609 | fo.close() | |
609 | m = md5(foo) |
|
610 | m = md5(foo) | |
610 |
print(format % ('normal urllib', m. |
|
611 | print(format % ('normal urllib', node.hex(m.digest()))) | |
611 |
|
612 | |||
612 | # now install the keepalive handler and try again |
|
613 | # now install the keepalive handler and try again | |
613 | opener = urlreq.buildopener(HTTPHandler()) |
|
614 | opener = urlreq.buildopener(HTTPHandler()) | |
@@ -617,7 +618,7 b' def continuity(url):' | |||||
617 | foo = fo.read() |
|
618 | foo = fo.read() | |
618 | fo.close() |
|
619 | fo.close() | |
619 | m = md5(foo) |
|
620 | m = md5(foo) | |
620 |
print(format % ('keepalive read', m. |
|
621 | print(format % ('keepalive read', node.hex(m.digest()))) | |
621 |
|
622 | |||
622 | fo = urlreq.urlopen(url) |
|
623 | fo = urlreq.urlopen(url) | |
623 | foo = '' |
|
624 | foo = '' | |
@@ -629,7 +630,7 b' def continuity(url):' | |||||
629 | break |
|
630 | break | |
630 | fo.close() |
|
631 | fo.close() | |
631 | m = md5(foo) |
|
632 | m = md5(foo) | |
632 |
print(format % ('keepalive readline', m. |
|
633 | print(format % ('keepalive readline', node.hex(m.digest()))) | |
633 |
|
634 | |||
634 | def comp(N, url): |
|
635 | def comp(N, url): | |
635 | print(' making %i connections to:\n %s' % (N, url)) |
|
636 | print(' making %i connections to:\n %s' % (N, url)) |
@@ -2654,7 +2654,7 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||||
2654 | l = len(text) |
|
2654 | l = len(text) | |
2655 | s = hashlib.sha1('blob %d\0' % l) |
|
2655 | s = hashlib.sha1('blob %d\0' % l) | |
2656 | s.update(text) |
|
2656 | s.update(text) | |
2657 |
return s. |
|
2657 | return hex(s.digest()) | |
2658 |
|
2658 | |||
2659 | if opts.noprefix: |
|
2659 | if opts.noprefix: | |
2660 | aprefix = bprefix = '' |
|
2660 | aprefix = bprefix = '' |
@@ -12,7 +12,10 b' import hashlib' | |||||
12 | import os |
|
12 | import os | |
13 |
|
13 | |||
14 | from .i18n import _ |
|
14 | from .i18n import _ | |
15 |
from .node import |
|
15 | from .node import ( | |
|
16 | hex, | |||
|
17 | nullid, | |||
|
18 | ) | |||
16 | from . import ( |
|
19 | from . import ( | |
17 | error, |
|
20 | error, | |
18 | match as matchmod, |
|
21 | match as matchmod, | |
@@ -173,12 +176,12 b' def configsignature(repo, includetemp=Tr' | |||||
173 | tempsignature = '0' |
|
176 | tempsignature = '0' | |
174 |
|
177 | |||
175 | if signature is None or (includetemp and tempsignature is None): |
|
178 | if signature is None or (includetemp and tempsignature is None): | |
176 |
signature = hashlib.sha1(repo.vfs.tryread('sparse')). |
|
179 | signature = hex(hashlib.sha1(repo.vfs.tryread('sparse')).digest()) | |
177 | cache['signature'] = signature |
|
180 | cache['signature'] = signature | |
178 |
|
181 | |||
179 | if includetemp: |
|
182 | if includetemp: | |
180 | raw = repo.vfs.tryread('tempsparse') |
|
183 | raw = repo.vfs.tryread('tempsparse') | |
181 |
tempsignature = hashlib.sha1(raw). |
|
184 | tempsignature = hex(hashlib.sha1(raw).digest()) | |
182 | cache['tempsignature'] = tempsignature |
|
185 | cache['tempsignature'] = tempsignature | |
183 |
|
186 | |||
184 | return '%s %s' % (signature, tempsignature) |
|
187 | return '%s %s' % (signature, tempsignature) |
@@ -17,6 +17,7 b' import ssl' | |||||
17 | from .i18n import _ |
|
17 | from .i18n import _ | |
18 | from . import ( |
|
18 | from . import ( | |
19 | error, |
|
19 | error, | |
|
20 | node, | |||
20 | pycompat, |
|
21 | pycompat, | |
21 | util, |
|
22 | util, | |
22 | ) |
|
23 | ) | |
@@ -808,9 +809,9 b' def validatesocket(sock):' | |||||
808 | # If a certificate fingerprint is pinned, use it and only it to |
|
809 | # If a certificate fingerprint is pinned, use it and only it to | |
809 | # validate the remote cert. |
|
810 | # validate the remote cert. | |
810 | peerfingerprints = { |
|
811 | peerfingerprints = { | |
811 |
'sha1': hashlib.sha1(peercert). |
|
812 | 'sha1': node.hex(hashlib.sha1(peercert).digest()), | |
812 |
'sha256': hashlib.sha256(peercert). |
|
813 | 'sha256': node.hex(hashlib.sha256(peercert).digest()), | |
813 |
'sha512': hashlib.sha512(peercert). |
|
814 | 'sha512': node.hex(hashlib.sha512(peercert).digest()), | |
814 | } |
|
815 | } | |
815 |
|
816 | |||
816 | def fmtfingerprint(s): |
|
817 | def fmtfingerprint(s): |
@@ -15,6 +15,7 b' import stat' | |||||
15 | from .i18n import _ |
|
15 | from .i18n import _ | |
16 | from . import ( |
|
16 | from . import ( | |
17 | error, |
|
17 | error, | |
|
18 | node, | |||
18 | policy, |
|
19 | policy, | |
19 | pycompat, |
|
20 | pycompat, | |
20 | util, |
|
21 | util, | |
@@ -221,7 +222,7 b' def _auxencode(path, dotencode):' | |||||
221 | _maxshortdirslen = 8 * (_dirprefixlen + 1) - 4 |
|
222 | _maxshortdirslen = 8 * (_dirprefixlen + 1) - 4 | |
222 |
|
223 | |||
223 | def _hashencode(path, dotencode): |
|
224 | def _hashencode(path, dotencode): | |
224 |
digest = hashlib.sha1(path). |
|
225 | digest = node.hex(hashlib.sha1(path).digest()) | |
225 | le = lowerencode(path[5:]).split('/') # skips prefix 'data/' or 'meta/' |
|
226 | le = lowerencode(path[5:]).split('/') # skips prefix 'data/' or 'meta/' | |
226 | parts = _auxencode(le, dotencode) |
|
227 | parts = _auxencode(le, dotencode) | |
227 | basename = parts[-1] |
|
228 | basename = parts[-1] |
@@ -55,7 +55,7 b' def _expandedabspath(path):' | |||||
55 |
|
55 | |||
56 | def _getstorehashcachename(remotepath): |
|
56 | def _getstorehashcachename(remotepath): | |
57 | '''get a unique filename for the store hash cache of a remote repository''' |
|
57 | '''get a unique filename for the store hash cache of a remote repository''' | |
58 |
return hashlib.sha1(_expandedabspath(remotepath)). |
|
58 | return node.hex(hashlib.sha1(_expandedabspath(remotepath)).digest())[0:12] | |
59 |
|
59 | |||
60 | class SubrepoAbort(error.Abort): |
|
60 | class SubrepoAbort(error.Abort): | |
61 | """Exception class used to avoid handling a subrepo error more than once""" |
|
61 | """Exception class used to avoid handling a subrepo error more than once""" | |
@@ -789,7 +789,7 b' class hgsubrepo(abstractsubrepo):' | |||||
789 | yield '# %s\n' % _expandedabspath(remotepath) |
|
789 | yield '# %s\n' % _expandedabspath(remotepath) | |
790 | vfs = self._repo.vfs |
|
790 | vfs = self._repo.vfs | |
791 | for relname in filelist: |
|
791 | for relname in filelist: | |
792 |
filehash = hashlib.sha1(vfs.tryread(relname)). |
|
792 | filehash = node.hex(hashlib.sha1(vfs.tryread(relname)).digest()) | |
793 | yield '%s = %s\n' % (relname, filehash) |
|
793 | yield '%s = %s\n' % (relname, filehash) | |
794 |
|
794 | |||
795 | @propertycache |
|
795 | @propertycache |
@@ -49,6 +49,7 b' from . import (' | |||||
49 | encoding, |
|
49 | encoding, | |
50 | error, |
|
50 | error, | |
51 | i18n, |
|
51 | i18n, | |
|
52 | node as nodemod, | |||
52 | policy, |
|
53 | policy, | |
53 | pycompat, |
|
54 | pycompat, | |
54 | urllibcompat, |
|
55 | urllibcompat, | |
@@ -265,7 +266,7 b' class digester(object):' | |||||
265 | def __getitem__(self, key): |
|
266 | def __getitem__(self, key): | |
266 | if key not in DIGESTS: |
|
267 | if key not in DIGESTS: | |
267 | raise Abort(_('unknown digest type: %s') % k) |
|
268 | raise Abort(_('unknown digest type: %s') % k) | |
268 |
return self._hashes[key]. |
|
269 | return nodemod.hex(self._hashes[key].digest()) | |
269 |
|
270 | |||
270 | def __iter__(self): |
|
271 | def __iter__(self): | |
271 | return iter(self._hashes) |
|
272 | return iter(self._hashes) |
General Comments 0
You need to be logged in to leave comments.
Login now