changeset 21155:148e98e74e25

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 17 Apr 2014 17:21:39 -0400
parents e110e2b79135
children 2bfb0598206a
files mercurial/exchange.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)