bundle2: call a hook prior to closing the transaction
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 17 Apr 2014 17:21:39 -0400
changeset 21155 148e98e74e25
parent 21154 e110e2b79135
child 21156 2bfb0598206a
bundle2: call a hook prior to closing the transaction We call a dedicated hook right before closing the transaction. This will let people abort unbundling with all the information in hand. This hook is experimental and will not survive in future versions.
mercurial/exchange.py
--- a/mercurial/exchange.py	Thu Apr 17 17:16:21 2014 -0400
+++ b/mercurial/exchange.py	Thu Apr 17 17:21:39 2014 -0400
@@ -728,6 +728,10 @@
             tr = repo.transaction('unbundle')
             tr.hookargs['bundle2-exp'] = '1'
             r = bundle2.processbundle(repo, cg, lambda: tr).reply
+            cl = repo.unfiltered().changelog
+            p = cl.writepending() and repo.root or ""
+            repo.hook('b2x-pretransactionclose', throw=True, source=source,
+                      url=url, pending=p, **tr.hookargs)
             tr.close()
         else:
             r = changegroup.addchangegroup(repo, cg, source, url)