From patchwork Thu Mar 13 18:48:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1, of, 2] wireproto: extract capabilities list in outside the wireproto function From: Pierre-Yves David X-Patchwork-Id: 3938 Message-Id: <1bfa5d82da6540e6559c.1394736510@marginatus.alto.octopoid.net> To: mercurial-devel@selenic.com Cc: pierre-yves.david@ens-lyon.org Date: Thu, 13 Mar 2014 11:48:30 -0700 # HG changeset patch # User Pierre-Yves David # Date 1394527082 25200 # Tue Mar 11 01:38:02 2014 -0700 # Node ID 1bfa5d82da6540e6559c3396c692db848ea650f2 # Parent 2764148aa088da248f74d1bf92e5d504f7f4db9a wireproto: extract capabilities list in outside the wireproto function Before that it was over complicated to add capabilities from an extension. This mimic was is done for capabilities in localrepo. diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -412,13 +412,16 @@ def branches(repo, proto, nodes): r = [] for b in repo.branches(nodes): r.append(encodelist(b) + "\n") return "".join(r) + +WIREPROTOCAPS = ['lookup', 'changegroupsubset', 'branchmap', 'pushkey', + 'known', 'getbundle', 'unbundlehash', 'batch'] def capabilities(repo, proto): - caps = ('lookup changegroupsubset branchmap pushkey known getbundle ' - 'unbundlehash batch').split() + # copy to prevent modification of the global list + caps = list(WIREPROTOCAPS) if _allowstream(repo.ui): if repo.ui.configbool('server', 'preferuncompressed', False): caps.append('stream-preferred') requiredformats = repo.requirements & repo.supportedformats # if our local revlogs are just revlogv1, add 'stream' cap