Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 31508:590319c07259
localrepo: ensure transaction id is fully bytes on py3
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 19 Mar 2017 01:08:59 -0400 |
parents | 413b44003462 |
children | 5c9936193145 |
comparison
equal
deleted
inserted
replaced
31507:4d1dd9cf0dca | 31508:590319c07259 |
---|---|
47 obsolete, | 47 obsolete, |
48 pathutil, | 48 pathutil, |
49 peer, | 49 peer, |
50 phases, | 50 phases, |
51 pushkey, | 51 pushkey, |
52 pycompat, | |
52 repoview, | 53 repoview, |
53 revset, | 54 revset, |
54 revsetlang, | 55 revsetlang, |
55 scmutil, | 56 scmutil, |
56 store, | 57 store, |
1080 raise error.RepoError( | 1081 raise error.RepoError( |
1081 _("abandoned transaction found"), | 1082 _("abandoned transaction found"), |
1082 hint=_("run 'hg recover' to clean up transaction")) | 1083 hint=_("run 'hg recover' to clean up transaction")) |
1083 | 1084 |
1084 idbase = "%.40f#%f" % (random.random(), time.time()) | 1085 idbase = "%.40f#%f" % (random.random(), time.time()) |
1085 txnid = 'TXN:' + hashlib.sha1(idbase).hexdigest() | 1086 ha = hashlib.sha1(idbase).hexdigest() |
1087 if pycompat.ispy3: | |
1088 ha = ha.encode('latin1') | |
1089 txnid = 'TXN:' + ha | |
1086 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) | 1090 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) |
1087 | 1091 |
1088 self._writejournal(desc) | 1092 self._writejournal(desc) |
1089 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] | 1093 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] |
1090 if report: | 1094 if report: |