Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 21141:d8dd19e09ed4
bundle2: advertise bundle2 caps in server capabilities
We can now retrieve them from the server during push. The capabilities are
encoded the same way as in `replycaps` part (with an extra layer of urlquoting
to escape separators).
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 17 Apr 2014 01:49:20 -0400 |
parents | 4aeb8da68090 |
children | 7a20fe8dc080 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Apr 17 01:50:28 2014 -0400 +++ b/mercurial/localrepo.py Thu Apr 17 01:49:20 2014 -0400 @@ -6,6 +6,7 @@ # GNU General Public License version 2 or any later version. from node import hex, nullid, short from i18n import _ +import urllib import peer, changegroup, subrepo, pushkey, obsolete, repoview import changelog, dirstate, filelog, manifest, context, bookmarks, phases import lock as lockmod @@ -63,7 +64,7 @@ return wrapper moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle', - 'bundle2', 'unbundle')) + 'unbundle')) legacycaps = moderncaps.union(set(['changegroupsubset'])) class localpeer(peer.peerrepository): @@ -304,9 +305,10 @@ 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): + if self.ui.configbool('server', 'bundle2', False): caps = set(caps) - caps.discard('bundle2') + capsblob = bundle2.encodecaps(self.bundle2caps) + caps.add('bundle2=' + urllib.quote(capsblob)) return caps def _applyrequirements(self, requirements):