Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 31523:f42ec07db6a9
localrepo: use node.hex instead of awkward .encode('latin1')
Spotted as an option by Yuya. Thanks!
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 20 Mar 2017 22:06:57 -0400 |
parents | 2244fb3eee49 |
children | 48b9c9ca09b7 |
comparison
equal
deleted
inserted
replaced
31522:23fc9b98445f | 31523:f42ec07db6a9 |
---|---|
1081 raise error.RepoError( | 1081 raise error.RepoError( |
1082 _("abandoned transaction found"), | 1082 _("abandoned transaction found"), |
1083 hint=_("run 'hg recover' to clean up transaction")) | 1083 hint=_("run 'hg recover' to clean up transaction")) |
1084 | 1084 |
1085 idbase = "%.40f#%f" % (random.random(), time.time()) | 1085 idbase = "%.40f#%f" % (random.random(), time.time()) |
1086 ha = hashlib.sha1(idbase).hexdigest() | 1086 ha = hex(hashlib.sha1(idbase).digest()) |
1087 if pycompat.ispy3: | |
1088 ha = ha.encode('latin1') | |
1089 txnid = 'TXN:' + ha | 1087 txnid = 'TXN:' + ha |
1090 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) | 1088 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) |
1091 | 1089 |
1092 self._writejournal(desc) | 1090 self._writejournal(desc) |
1093 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] | 1091 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] |