# HG changeset patch # User Pierre-Yves David # Date 2015-06-01 17:28:40 # Node ID 30ab130af2216d2ac3e01d3364dc4291e9c48eb8 # Parent 0c2ded041d1036d29d2d8b8e0a3cbe4399a7703f 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. diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -203,11 +203,12 @@ def unescapearg(escaped): # # :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 @@ class wirepeer(peer.peerrepository): 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 @@ def getbundle(repo, proto, others): 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) diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -466,8 +466,8 @@ debug output sending getbundle command bundle2-input-bundle: with-transaction bundle2-input-part: "listkeys" (params: 1 mandatory) supported + bundle2-input-part: "listkeys" (params: 1 mandatory) supported bundle2-input-part: total payload size 45 - bundle2-input-part: "listkeys" (params: 1 mandatory) supported bundle2-input-bundle: 1 parts total checking for updated bookmarks preparing listkeys for "phases"