Patchwork [1,of,3,V2,(resend)] wireproto: extract capabilities list in outside the wireproto function

login
register
mail settings
Submitter Pierre-Yves David
Date March 18, 2014, 6:12 p.m.
Message ID <0d064ce8b34079cb817e.1395166357@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/3966/
State Accepted
Commit cdc3ac896997536e60541703d2c2cd26af03ac3d
Headers show

Comments

Pierre-Yves David - March 18, 2014, 6:12 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1394527082 25200
#      Tue Mar 11 01:38:02 2014 -0700
# Node ID 0d064ce8b34079cb817eb265bf1827fa0aee1629
# Parent  41e1064486f96bd2761acf85e197e627346c292e
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.

Patch

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