changeset 21158:8f6530b62177

bundle2: add a way to add parts during a `getbundle` request We add a hook function to let extensions add parts to the bundle.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 17 Apr 2014 17:32:34 -0400
parents 60ad2ea5b106
children 024f38f6d5f6
files mercurial/exchange.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Apr 17 17:25:50 2014 -0400
+++ b/mercurial/exchange.py	Thu Apr 17 17:32:34 2014 -0400
@@ -691,8 +691,15 @@
     bundler = bundle2.bundle20(repo.ui, b2caps)
     part = bundle2.bundlepart('b2x:changegroup', data=cg.getchunks())
     bundler.addpart(part)
+    _getbundleextrapart(bundler, repo, source, heads=None, common=None,
+                        bundlecaps=None, **kwargs)
     return util.chunkbuffer(bundler.getchunks())
 
+def _getbundleextrapart(bundler, repo, source, heads=None, common=None,
+                        bundlecaps=None, **kwargs):
+    """hook function to let extensions add parts to the requested bundle"""
+    pass
+
 class PushRaced(RuntimeError):
     """An exception raised during unbundling that indicate a push race"""