diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -16,7 +16,7 @@ import match as matchmod 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 @@ -960,6 +960,8 @@ class localrepository(object): _("abandoned transaction found"), hint=_("run 'hg recover' to clean up transaction")) + idbase = "%.40f#%f" % (random.random(), time.time()) + txnid = 'TXN:' + util.sha1(idbase).hexdigest() self.hook('pretxnopen', throw=True, txnname=desc) self._writejournal(desc) @@ -984,8 +986,7 @@ class localrepository(object): 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.