Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 24740:d283517b260b
transaction: introduce a transaction ID, to be available to all hooks
The transaction ID is built from the object ID and creation time stamp to make
sure it is unique.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 15 Apr 2015 11:11:54 -0400 |
parents | ea0d5c8e047f |
children | bedefc611f25 |
comparison
equal
deleted
inserted
replaced
24739:ea0d5c8e047f | 24740:d283517b260b |
---|---|
962 "journal", | 962 "journal", |
963 "undo", | 963 "undo", |
964 aftertrans(renames), | 964 aftertrans(renames), |
965 self.store.createmode, | 965 self.store.createmode, |
966 validator=validate) | 966 validator=validate) |
967 | |
968 trid = 'TXN:' + util.sha1("%s#%f" % (id(tr), time.time())).hexdigest() | |
969 tr.hookargs['TXNID'] = trid | |
967 # note: writing the fncache only during finalize mean that the file is | 970 # note: writing the fncache only during finalize mean that the file is |
968 # outdated when running hooks. As fncache is used for streaming clone, | 971 # outdated when running hooks. As fncache is used for streaming clone, |
969 # this is not expected to break anything that happen during the hooks. | 972 # this is not expected to break anything that happen during the hooks. |
970 tr.addfinalize('flush-fncache', self.store.write) | 973 tr.addfinalize('flush-fncache', self.store.write) |
971 def txnclosehook(tr2): | 974 def txnclosehook(tr2): |