diff 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
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Apr 14 13:07:41 2015 -0400
+++ b/mercurial/localrepo.py	Wed Apr 15 11:11:54 2015 -0400
@@ -964,6 +964,9 @@
                                      aftertrans(renames),
                                      self.store.createmode,
                                      validator=validate)
+
+        trid = 'TXN:' + util.sha1("%s#%f" % (id(tr), time.time())).hexdigest()
+        tr.hookargs['TXNID'] = trid
         # 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.