##// 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 import merge as mergemod
16 import merge as mergemod
17 import tags as tagsmod
17 import tags as tagsmod
18 from lock import release
18 from lock import release
19 import weakref, errno, os, time, inspect
19 import weakref, errno, os, time, inspect, random
20 import branchmap, pathutil
20 import branchmap, pathutil
21 import namespaces
21 import namespaces
22 propertycache = util.propertycache
22 propertycache = util.propertycache
@@ -960,6 +960,8 b' class localrepository(object):'
960 _("abandoned transaction found"),
960 _("abandoned transaction found"),
961 hint=_("run 'hg recover' to clean up transaction"))
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 self.hook('pretxnopen', throw=True, txnname=desc)
965 self.hook('pretxnopen', throw=True, txnname=desc)
964
966
965 self._writejournal(desc)
967 self._writejournal(desc)
@@ -984,8 +986,7 b' class localrepository(object):'
984 self.store.createmode,
986 self.store.createmode,
985 validator=validate)
987 validator=validate)
986
988
987 trid = 'TXN:' + util.sha1("%s#%f" % (id(tr), time.time())).hexdigest()
989 tr.hookargs['txnid'] = txnid
988 tr.hookargs['txnid'] = trid
989 # note: writing the fncache only during finalize mean that the file is
990 # note: writing the fncache only during finalize mean that the file is
990 # outdated when running hooks. As fncache is used for streaming clone,
991 # outdated when running hooks. As fncache is used for streaming clone,
991 # this is not expected to break anything that happen during the hooks.
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