diff mercurial/bundle2.py @ 23439:743736fc7c41

bundle2-push: provide transaction to reply unbundler This patch series is intended to allow bundle2 push reply part handlers to make changes to the local repository; it has been developed in parallel with an extension that allows the server to rebase incoming changesets while applying them. This diff adds an experimental config option "bundle2.pushback" which provides a transaction to the reply unbundler during a push operation. This behavior is opt-in because of potential security issues: the response can contain any part type that has a handler defined, allowing the server to make arbitrary changes to the local repository.
author Eric Sumner <ericsumner@fb.com>
date Fri, 21 Nov 2014 15:50:38 -0800
parents 6e0ecb9a2e19
children 94b25d71dd0f
line wrap: on
line diff
--- a/mercurial/bundle2.py	Mon Nov 24 16:04:44 2014 -0800
+++ b/mercurial/bundle2.py	Fri Nov 21 15:50:38 2014 -0800
@@ -877,7 +877,7 @@
                 'b2x:remote-changegroup': ('http', 'https'),
                }
 
-def getrepocaps(repo):
+def getrepocaps(repo, allowpushback=False):
     """return the bundle2 capabilities for a given repo
 
     Exists to allow extensions (like evolution) to mutate the capabilities.
@@ -887,6 +887,8 @@
     if obsolete.isenabled(repo, obsolete.exchangeopt):
         supportedformat = tuple('V%i' % v for v in obsolete.formats)
         caps['b2x:obsmarkers'] = supportedformat
+    if allowpushback:
+        caps['b2x:pushback'] = ()
     return caps
 
 def bundle2caps(remote):