Mercurial > public > mercurial-scm > hg-stable
diff mercurial/wireproto.py @ 25403:30ab130af221
wireprotocol: distinguish list and set in getbundle argument
The 'bundlecaps' argument is expected to be a set, but 'listkeys' is
expected to be a list where ordering matters. We introduce a new 'scsv'
argument type for the 'set' version and move 'csv' to the 'list'
version.
'test-ssh.t' is changed because this introduced an instability in the order we
were producing listkeys parts.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 01 Jun 2015 10:28:40 -0700 |
parents | c50655b9c856 |
children | d8e7b0781ad7 |
line wrap: on
line diff
--- a/mercurial/wireproto.py Mon May 25 17:14:11 2015 -0700 +++ b/mercurial/wireproto.py Mon Jun 01 10:28:40 2015 -0700 @@ -203,11 +203,12 @@ # # :nodes: list of binary nodes # :csv: list of comma-separated values +# :scsv: list of comma-separated values return as set # :plain: string with no transformation needed. gboptsmap = {'heads': 'nodes', 'common': 'nodes', 'obsmarkers': 'boolean', - 'bundlecaps': 'csv', + 'bundlecaps': 'scsv', 'listkeys': 'csv', 'cg': 'boolean'} @@ -360,7 +361,7 @@ assert False, 'unexpected' elif keytype == 'nodes': value = encodelist(value) - elif keytype == 'csv': + elif keytype in ('csv', 'scsv'): value = ','.join(value) elif keytype == 'boolean': value = '%i' % bool(value) @@ -665,6 +666,8 @@ if keytype == 'nodes': opts[k] = decodelist(v) elif keytype == 'csv': + opts[k] = list(v.split(',')) + elif keytype == 'scsv': opts[k] = set(v.split(',')) elif keytype == 'boolean': opts[k] = bool(v)