4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
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 |
12 import transaction, store, encoding, exchange, bundle2 |
13 import transaction, store, encoding, exchange, bundle2 |
13 import scmutil, util, extensions, hook, error, revset |
14 import scmutil, util, extensions, hook, error, revset |
61 def wrapper(repo, *args, **kwargs): |
62 def wrapper(repo, *args, **kwargs): |
62 return orig(repo.unfiltered(), *args, **kwargs) |
63 return orig(repo.unfiltered(), *args, **kwargs) |
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): |
70 '''peer for a local repo; reflects only the most recent API''' |
71 '''peer for a local repo; reflects only the most recent API''' |
71 |
72 |
302 pass |
303 pass |
303 |
304 |
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): |
313 self.requirements = requirements |
315 self.requirements = requirements |
314 self.sopener.options = dict((r, 1) for r in requirements |
316 self.sopener.options = dict((r, 1) for r in requirements |