Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
20954:dba91f8060eb | 20955:12f161f08d74 |
---|---|
60 """decorate method that always need to be run on unfiltered version""" | 60 """decorate method that always need to be run on unfiltered version""" |
61 def wrapper(repo, *args, **kwargs): | 61 def wrapper(repo, *args, **kwargs): |
62 return orig(repo.unfiltered(), *args, **kwargs) | 62 return orig(repo.unfiltered(), *args, **kwargs) |
63 return wrapper | 63 return wrapper |
64 | 64 |
65 moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle')) | 65 moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle', |
66 'bundle2')) | |
66 legacycaps = moderncaps.union(set(['changegroupsubset'])) | 67 legacycaps = moderncaps.union(set(['changegroupsubset'])) |
67 | 68 |
68 class localpeer(peer.peerrepository): | 69 class localpeer(peer.peerrepository): |
69 '''peer for a local repo; reflects only the most recent API''' | 70 '''peer for a local repo; reflects only the most recent API''' |
70 | 71 |
274 | 275 |
275 def close(self): | 276 def close(self): |
276 pass | 277 pass |
277 | 278 |
278 def _restrictcapabilities(self, caps): | 279 def _restrictcapabilities(self, caps): |
280 # bundle2 is not ready for prime time, drop it unless explicitly | |
281 # required by the tests (or some brave tester) | |
282 if not self.ui.configbool('server', 'bundle2', False): | |
283 caps = set(caps) | |
284 caps.remove('bundle2') | |
279 return caps | 285 return caps |
280 | 286 |
281 def _applyrequirements(self, requirements): | 287 def _applyrequirements(self, requirements): |
282 self.requirements = requirements | 288 self.requirements = requirements |
283 self.sopener.options = dict((r, 1) for r in requirements | 289 self.sopener.options = dict((r, 1) for r in requirements |