mercurial/localrepo.py
branchstable
changeset 25267 69c5cab0b893
parent 25219 2664f536a97e
child 25268 a973b050621d
--- a/mercurial/localrepo.py	Sat May 23 11:14:00 2015 +0900
+++ b/mercurial/localrepo.py	Mon May 25 01:26:19 2015 +0900
@@ -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
@@ -960,6 +960,8 @@
                 _("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 @@
                                      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.