##// END OF EJS Templates
transaction: separate calculating TXNID from creating transaction object...
FUJIWARA Katsunori -
r25267:69c5cab0 stable
parent child Browse files
Show More
@@ -16,7 +16,7 b' import match as matchmod'
16 16 import merge as mergemod
17 17 import tags as tagsmod
18 18 from lock import release
19 import weakref, errno, os, time, inspect
19 import weakref, errno, os, time, inspect, random
20 20 import branchmap, pathutil
21 21 import namespaces
22 22 propertycache = util.propertycache
@@ -960,6 +960,8 b' class localrepository(object):'
960 960 _("abandoned transaction found"),
961 961 hint=_("run 'hg recover' to clean up transaction"))
962 962
963 idbase = "%.40f#%f" % (random.random(), time.time())
964 txnid = 'TXN:' + util.sha1(idbase).hexdigest()
963 965 self.hook('pretxnopen', throw=True, txnname=desc)
964 966
965 967 self._writejournal(desc)
@@ -984,8 +986,7 b' class localrepository(object):'
984 986 self.store.createmode,
985 987 validator=validate)
986 988
987 trid = 'TXN:' + util.sha1("%s#%f" % (id(tr), time.time())).hexdigest()
988 tr.hookargs['txnid'] = trid
989 tr.hookargs['txnid'] = txnid
989 990 # note: writing the fncache only during finalize mean that the file is
990 991 # outdated when running hooks. As fncache is used for streaming clone,
991 992 # this is not expected to break anything that happen during the hooks.
General Comments 0
You need to be logged in to leave comments. Login now