156 args = ','.join('%s=%s' % (escapearg(k), escapearg(v)) |
156 args = ','.join('%s=%s' % (escapearg(k), escapearg(v)) |
157 for k, v in argsdict.iteritems()) |
157 for k, v in argsdict.iteritems()) |
158 cmds.append('%s %s' % (op, args)) |
158 cmds.append('%s %s' % (op, args)) |
159 |
159 |
160 return ';'.join(cmds) |
160 return ';'.join(cmds) |
|
161 |
|
162 def clientcompressionsupport(proto): |
|
163 """Returns a list of compression methods supported by the client. |
|
164 |
|
165 Returns a list of the compression methods supported by the client |
|
166 according to the protocol capabilities. If no such capability has |
|
167 been announced, fallback to the default of zlib and uncompressed. |
|
168 """ |
|
169 for cap in proto.getprotocaps(): |
|
170 if cap.startswith('comp='): |
|
171 return cap[5:].split(',') |
|
172 return ['zlib', 'none'] |
161 |
173 |
162 # mapping of options accepted by getbundle and their types |
174 # mapping of options accepted by getbundle and their types |
163 # |
175 # |
164 # Meant to be extended by extensions. It is extensions responsibility to ensure |
176 # Meant to be extended by extensions. It is extensions responsibility to ensure |
165 # such options are properly processed in exchange.getbundle. |
177 # such options are properly processed in exchange.getbundle. |
1024 |
1036 |
1025 @wireprotocommand('known', 'nodes *', permission='pull') |
1037 @wireprotocommand('known', 'nodes *', permission='pull') |
1026 def known(repo, proto, nodes, others): |
1038 def known(repo, proto, nodes, others): |
1027 v = ''.join(b and '1' or '0' for b in repo.known(decodelist(nodes))) |
1039 v = ''.join(b and '1' or '0' for b in repo.known(decodelist(nodes))) |
1028 return wireprototypes.bytesresponse(v) |
1040 return wireprototypes.bytesresponse(v) |
|
1041 |
|
1042 @wireprotocommand('protocaps', 'caps', permission='pull', |
|
1043 transportpolicy=POLICY_V1_ONLY) |
|
1044 def protocaps(repo, proto, caps): |
|
1045 if proto.name == wireprototypes.SSHV1: |
|
1046 proto._protocaps = set(caps.split(' ')) |
|
1047 return wireprototypes.bytesresponse('OK') |
1029 |
1048 |
1030 @wireprotocommand('pushkey', 'namespace key old new', permission='push') |
1049 @wireprotocommand('pushkey', 'namespace key old new', permission='push') |
1031 def pushkey(repo, proto, namespace, key, old, new): |
1050 def pushkey(repo, proto, namespace, key, old, new): |
1032 # compatibility with pre-1.8 clients which were accidentally |
1051 # compatibility with pre-1.8 clients which were accidentally |
1033 # sending raw binary nodes rather than utf-8-encoded hex |
1052 # sending raw binary nodes rather than utf-8-encoded hex |