Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 25270:61b3529e2377
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 26 May 2015 07:44:37 -0500 |
parents | 7504a7325e4c a973b050621d |
children | 144085249c3f |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon May 25 11:06:49 2015 -0700 +++ b/mercurial/localrepo.py Tue May 26 07:44:37 2015 -0500 @@ -16,7 +16,7 @@ import merge as mergemod import tags as tagsmod from lock import release -import weakref, errno, os, time, inspect +import weakref, errno, os, time, inspect, random import branchmap, pathutil import namespaces propertycache = util.propertycache @@ -959,7 +959,9 @@ _("abandoned transaction found"), hint=_("run 'hg recover' to clean up transaction")) - self.hook('pretxnopen', throw=True, txnname=desc) + idbase = "%.40f#%f" % (random.random(), time.time()) + txnid = 'TXN:' + util.sha1(idbase).hexdigest() + self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) self._writejournal(desc) renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] @@ -983,8 +985,7 @@ self.store.createmode, validator=validate) - trid = 'TXN:' + util.sha1("%s#%f" % (id(tr), time.time())).hexdigest() - tr.hookargs['txnid'] = trid + tr.hookargs['txnid'] = txnid # note: writing the fncache only during finalize mean that the file is # outdated when running hooks. As fncache is used for streaming clone, # this is not expected to break anything that happen during the hooks.