obsmarker: move bundle2caps from the localrepo class to the bundle2 module
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 25 Aug 2014 19:17:06 +0200
changeset 22341 2d16b39601b5
parent 22340 394a17de6a2d
child 22342 262c5cc126c1
obsmarker: move bundle2caps from the localrepo class to the bundle2 module The localrepo path was quicker, easier, more seductive. We'll soon add a function in another changeset to alter the capabilities.
mercurial/bundle2.py
mercurial/exchange.py
mercurial/localrepo.py
mercurial/wireproto.py
--- a/mercurial/bundle2.py	Mon Aug 25 18:35:39 2014 +0200
+++ b/mercurial/bundle2.py	Mon Aug 25 19:17:06 2014 +0200
@@ -775,6 +775,12 @@
             self.consumed = True
         return data
 
+capabilities = {'HG2X': (),
+                'b2x:listkeys': (),
+                'b2x:pushkey': (),
+                'b2x:changegroup': (),
+               }
+
 def bundle2caps(remote):
     """return the bundlecapabilities of a peer as dict"""
     raw = remote.capable('bundle2-exp')
--- a/mercurial/exchange.py	Mon Aug 25 18:35:39 2014 +0200
+++ b/mercurial/exchange.py	Mon Aug 25 19:17:06 2014 +0200
@@ -465,7 +465,7 @@
     evolve in the future."""
     bundler = bundle2.bundle20(pushop.ui, bundle2.bundle2caps(pushop.remote))
     # create reply capability
-    capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
+    capsblob = bundle2.encodecaps(bundle2.capabilities)
     bundler.newpart('b2x:replycaps', data=capsblob)
     replyhandlers = []
     for partgenname in b2partsgenorder:
@@ -922,7 +922,7 @@
 def caps20to10(repo):
     """return a set with appropriate options to use bundle20 during getbundle"""
     caps = set(['HG2X'])
-    capsblob = bundle2.encodecaps(repo.bundle2caps)
+    capsblob = bundle2.encodecaps(bundle2.capabilities)
     caps.add('bundle2=' + urllib.quote(capsblob))
     return caps
 
--- a/mercurial/localrepo.py	Mon Aug 25 18:35:39 2014 +0200
+++ b/mercurial/localrepo.py	Mon Aug 25 19:17:06 2014 +0200
@@ -180,12 +180,6 @@
     requirements = ['revlogv1']
     filtername = None
 
-    bundle2caps = {'HG2X': (),
-                   'b2x:listkeys': (),
-                   'b2x:pushkey': (),
-                   'b2x:changegroup': (),
-                  }
-
     # a list of (ui, featureset) functions.
     # only functions defined in module of enabled extensions are invoked
     featuresetupfuncs = set()
@@ -311,7 +305,7 @@
         # required by the tests (or some brave tester)
         if self.ui.configbool('experimental', 'bundle2-exp', False):
             caps = set(caps)
-            capsblob = bundle2.encodecaps(self.bundle2caps)
+            capsblob = bundle2.encodecaps(bundle2.capabilities)
             caps.add('bundle2-exp=' + urllib.quote(capsblob))
         return caps
 
--- a/mercurial/wireproto.py	Mon Aug 25 18:35:39 2014 +0200
+++ b/mercurial/wireproto.py	Mon Aug 25 19:17:06 2014 +0200
@@ -609,7 +609,7 @@
         else:
             caps.append('streamreqs=%s' % ','.join(requiredformats))
     if repo.ui.configbool('experimental', 'bundle2-exp', False):
-        capsblob = bundle2.encodecaps(repo.bundle2caps)
+        capsblob = bundle2.encodecaps(bundle2.capabilities)
         caps.append('bundle2-exp=' + urllib.quote(capsblob))
     caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
     caps.append('httpheader=1024')