##// END OF EJS Templates
bundle2: advertise bundle2 caps in server capabilities...
Pierre-Yves David -
r21141:d8dd19e0 default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from i18n import _
8 from i18n import _
9 from node import hex, nullid
9 from node import hex, nullid
10 import errno
10 import errno, urllib
11 import util, scmutil, changegroup, base85
11 import util, scmutil, changegroup, base85
12 import discovery, phases, obsolete, bookmarks, bundle2
12 import discovery, phases, obsolete, bookmarks, bundle2
13
13
@@ -207,7 +207,9 b' def _pushbundle2(pushop):'
207 The only currently supported type of data is changegroup but this will
207 The only currently supported type of data is changegroup but this will
208 evolve in the future."""
208 evolve in the future."""
209 # Send known head to the server for race detection.
209 # Send known head to the server for race detection.
210 bundler = bundle2.bundle20(pushop.ui)
210 capsblob = urllib.unquote(pushop.remote.capable('bundle2'))
211 caps = bundle2.decodecaps(capsblob)
212 bundler = bundle2.bundle20(pushop.ui, caps)
211 bundler.addpart(bundle2.bundlepart('replycaps'))
213 bundler.addpart(bundle2.bundlepart('replycaps'))
212 if not pushop.force:
214 if not pushop.force:
213 part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads))
215 part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads))
@@ -6,6 +6,7 b''
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7 from node import hex, nullid, short
7 from node import hex, nullid, short
8 from i18n import _
8 from i18n import _
9 import urllib
9 import peer, changegroup, subrepo, pushkey, obsolete, repoview
10 import peer, changegroup, subrepo, pushkey, obsolete, repoview
10 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
11 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
11 import lock as lockmod
12 import lock as lockmod
@@ -63,7 +64,7 b' def unfilteredmethod(orig):'
63 return wrapper
64 return wrapper
64
65
65 moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle',
66 moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle',
66 'bundle2', 'unbundle'))
67 'unbundle'))
67 legacycaps = moderncaps.union(set(['changegroupsubset']))
68 legacycaps = moderncaps.union(set(['changegroupsubset']))
68
69
69 class localpeer(peer.peerrepository):
70 class localpeer(peer.peerrepository):
@@ -304,9 +305,10 b' class localrepository(object):'
304 def _restrictcapabilities(self, caps):
305 def _restrictcapabilities(self, caps):
305 # bundle2 is not ready for prime time, drop it unless explicitly
306 # bundle2 is not ready for prime time, drop it unless explicitly
306 # required by the tests (or some brave tester)
307 # required by the tests (or some brave tester)
307 if not self.ui.configbool('server', 'bundle2', False):
308 if self.ui.configbool('server', 'bundle2', False):
308 caps = set(caps)
309 caps = set(caps)
309 caps.discard('bundle2')
310 capsblob = bundle2.encodecaps(self.bundle2caps)
311 caps.add('bundle2=' + urllib.quote(capsblob))
310 return caps
312 return caps
311
313
312 def _applyrequirements(self, requirements):
314 def _applyrequirements(self, requirements):
@@ -586,7 +586,8 b' def _capabilities(repo, proto):'
586 else:
586 else:
587 caps.append('streamreqs=%s' % ','.join(requiredformats))
587 caps.append('streamreqs=%s' % ','.join(requiredformats))
588 if repo.ui.configbool('server', 'bundle2', False):
588 if repo.ui.configbool('server', 'bundle2', False):
589 caps.append('bundle2')
589 capsblob = bundle2.encodecaps(repo.bundle2caps)
590 caps.append('bundle2=' + urllib.quote(capsblob))
590 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
591 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
591 caps.append('httpheader=1024')
592 caps.append('httpheader=1024')
592 return caps
593 return caps
General Comments 0
You need to be logged in to leave comments. Login now