Mercurial > hg-stable
changeset 34229:6193d810f7bb
repair: reliably obtain bytestr of node ids
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Tue, 22 Aug 2017 21:22:34 -0400 |
parents | 8e0358024a36 |
children | fa9f5d6733d3 |
files | mercurial/repair.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/repair.py Fri Sep 15 18:38:36 2017 -0400 +++ b/mercurial/repair.py Tue Aug 22 21:22:34 2017 -0400 @@ -12,7 +12,10 @@ import hashlib from .i18n import _ -from .node import short +from .node import ( + hex, + short, +) from . import ( bundle2, changegroup, @@ -35,8 +38,9 @@ # Include a hash of all the nodes in the filename for uniqueness allcommits = repo.set('%ln::%ln', bases, heads) allhashes = sorted(c.hex() for c in allcommits) - totalhash = hashlib.sha1(''.join(allhashes)).hexdigest() - name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix) + totalhash = hashlib.sha1(''.join(allhashes)).digest() + name = "%s/%s-%s-%s.hg" % (backupdir, short(node), + hex(totalhash[:4]), suffix) cgversion = changegroup.safeversion(repo) comp = None