--- a/mercurial/wireproto.py Thu Apr 05 17:51:10 2018 +0200
+++ b/mercurial/wireproto.py Sat Mar 24 17:57:22 2018 +0100
@@ -159,6 +159,18 @@
return ';'.join(cmds)
+def clientcompressionsupport(proto):
+ """Returns a list of compression methods supported by the client.
+
+ Returns a list of the compression methods supported by the client
+ according to the protocol capabilities. If no such capability has
+ been announced, fallback to the default of zlib and uncompressed.
+ """
+ for cap in proto.getprotocaps():
+ if cap.startswith('comp='):
+ return cap[5:].split(',')
+ return ['zlib', 'none']
+
# mapping of options accepted by getbundle and their types
#
# Meant to be extended by extensions. It is extensions responsibility to ensure
@@ -1027,6 +1039,13 @@
v = ''.join(b and '1' or '0' for b in repo.known(decodelist(nodes)))
return wireprototypes.bytesresponse(v)
+@wireprotocommand('protocaps', 'caps', permission='pull',
+ transportpolicy=POLICY_V1_ONLY)
+def protocaps(repo, proto, caps):
+ if proto.name == wireprototypes.SSHV1:
+ proto._protocaps = set(caps.split(' '))
+ return wireprototypes.bytesresponse('OK')
+
@wireprotocommand('pushkey', 'namespace key old new', permission='push')
def pushkey(repo, proto, namespace, key, old, new):
# compatibility with pre-1.8 clients which were accidentally