diff --git a/gerrit_client.py b/gerrit_client.py index 1263c10277..9e9082d250 100755 --- a/gerrit_client.py +++ b/gerrit_client.py @@ -237,7 +237,7 @@ The script can abandon up to 100 CLs per invocation. Examples: gerrit_client.py mass-abandon --host https://HOST -p 'project=repo2' gerrit_client.py mass-abandon --host https://HOST -p 'message=testing' -gerrit_client.py mass-abandon --host https://HOST -p 'is=wip' -p 'age:1y' +gerrit_client.py mass-abandon --host https://HOST -p 'is=wip' -p 'age=1y' ''') def CMDmass_abandon(parser, args): parser.add_option('-p', diff --git a/gerrit_util.py b/gerrit_util.py index 4d817c36cc..81d0f88d10 100644 --- a/gerrit_util.py +++ b/gerrit_util.py @@ -85,7 +85,7 @@ def _QueryString(params, first_param=None): https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes """ q = [urllib.parse.quote(first_param)] if first_param else [] - q.extend(['%s:%s' % (key, val) for key, val in params]) + q.extend(['%s:%s' % (key, val.replace(" ", "+")) for key, val in params]) return '+'.join(q) diff --git a/tests/gerrit_util_test.py b/tests/gerrit_util_test.py index 0f183b62f4..d22b41723b 100755 --- a/tests/gerrit_util_test.py +++ b/tests/gerrit_util_test.py @@ -425,11 +425,11 @@ class GerritUtilTest(unittest.TestCase): @mock.patch('gerrit_util.ReadHttpJsonResponse') def testQueryChanges(self, mockJsonResponse, mockCreateHttpConn): gerrit_util.QueryChanges( - 'host', [('key', 'val'), ('foo', 'bar')], 'first param', limit=500, + 'host', [('key', 'val'), ('foo', 'bar baz')], 'first param', limit=500, o_params=['PARAM_A', 'PARAM_B'], start='start') mockCreateHttpConn.assert_called_once_with( 'host', - ('changes/?q=first%20param+key:val+foo:bar' + ('changes/?q=first%20param+key:val+foo:bar+baz' '&start=start' '&n=500' '&o=PARAM_A'