diff mercurial/exchange.py @ 23000:90c425f80316

pull: call the `b2x-transactionclose` hook when closing the transaction We need a wider set of hooks to process all the changes that happened during the pull transaction. We reuse the experimental `b2x-transactionclose` hook set from server's unbundle for consistency. This hook is experimental and will not remains as-is forever, but this will open the door for experimentation in 3.2.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 15 Oct 2014 04:19:37 -0700
parents 44b16b59b80a
children 90f86ad3d4ff
line wrap: on
line diff
--- a/mercurial/exchange.py	Wed Oct 08 02:45:21 2014 -0700
+++ b/mercurial/exchange.py	Wed Oct 15 04:19:37 2014 -0700
@@ -834,7 +834,14 @@
     def closetransaction(self):
         """close transaction if created"""
         if self._tr is not None:
+            repo = self.repo
+            cl = repo.unfiltered().changelog
+            p = cl.writepending() and repo.root or ""
+            p = cl.writepending() and repo.root or ""
+            repo.hook('b2x-pretransactionclose', throw=True, pending=p,
+                      **self._tr.hookargs)
             self._tr.close()
+            repo.hook('b2x-transactionclose', **self._tr.hookargs)
 
     def releasetransaction(self):
         """release transaction if created"""