Mercurial > hg
comparison mercurial/util.py @ 35582:72b91f905065
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/D1792
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 29 Dec 2017 05:25:27 +0530 |
parents | c4caf530b1c7 |
children | fb0be099063f |
comparison
equal
deleted
inserted
replaced
35581:154754d1f137 | 35582:72b91f905065 |
---|---|
47 | 47 |
48 from . import ( | 48 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, |
55 ) | 56 ) |
56 | 57 |
263 h.update(data) | 264 h.update(data) |
264 | 265 |
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].hexdigest() | 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) |
272 | 273 |
273 @staticmethod | 274 @staticmethod |