[PATCH 7 of 7] repair: use bytestr() to turn hashes into bytes

Augie Fackler raf at durin42.com
Tue Aug 29 11:22:04 EDT 2017


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1503451354 14400
#      Tue Aug 22 21:22:34 2017 -0400
# Node ID 67e8c38e7efb154b63c23426d402e0ffdf0831aa
# Parent  ae30c980ec329715171d142644a6bda68114df57
repair: use bytestr() to turn hashes into bytes

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -21,6 +21,7 @@ from . import (
     exchange,
     obsolete,
     obsutil,
+    pycompat,
     util,
 )
 
@@ -36,7 +37,8 @@ def _bundle(repo, bases, heads, node, su
     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)
+    name = "%s/%s-%s-%s.hg" % (backupdir, pycompat.bytestr(short(node)),
+                               pycompat.bytestr(totalhash[:8]), suffix)
 
     cgversion = changegroup.safeversion(repo)
     comp = None


More information about the Mercurial-devel mailing list