diff mercurial/localrepo.py @ 20955:12f161f08d74

bundle2: allow pulling changegroups using bundle2 This changeset refactors the pull code to use a bundle2 when available. We keep bundle2 disabled by default. The current code is not ready for prime time. Ultimately we'll want to unify the API of `bunde10` and `bundle20` to have less different code. But for now, testing the bundle2 exchange flow is an higher priority.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 01 Apr 2014 23:41:32 -0700
parents dba91f8060eb
children ffddabb8aa5d
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Apr 04 01:51:54 2014 -0700
+++ b/mercurial/localrepo.py	Tue Apr 01 23:41:32 2014 -0700
@@ -62,7 +62,8 @@
         return orig(repo.unfiltered(), *args, **kwargs)
     return wrapper
 
-moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle'))
+moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle',
+                  'bundle2'))
 legacycaps = moderncaps.union(set(['changegroupsubset']))
 
 class localpeer(peer.peerrepository):
@@ -276,6 +277,11 @@
         pass
 
     def _restrictcapabilities(self, caps):
+        # bundle2 is not ready for prime time, drop it unless explicitly
+        # required by the tests (or some brave tester)
+        if not self.ui.configbool('server', 'bundle2', False):
+            caps = set(caps)
+            caps.remove('bundle2')
         return caps
 
     def _applyrequirements(self, requirements):