@@ -190,15 +190,15 @@ def update_cmd(patch_ids, commit_ref, state, delegate, archived, fmt):
190
190
191
191
192
192
@click .command (name = 'list' )
193
- @click .option ('--state' , metavar = 'STATE' , multiple = True ,
193
+ @click .option ('--state' , 'states' , metavar = 'STATE' , multiple = True ,
194
194
default = ['under-review' , 'new' ],
195
195
help = 'Show only patches matching these states. Should be '
196
196
'slugified representations of states. The available states '
197
197
'are instance dependant.' )
198
- @click .option ('--submitter' , metavar = 'SUBMITTER' , multiple = True ,
198
+ @click .option ('--submitter' , 'submitters' , metavar = 'SUBMITTER' , multiple = True ,
199
199
help = 'Show only patches by these submitters. Should be an '
200
200
'email, name or ID.' )
201
- @click .option ('--delegate' , metavar = 'DELEGATE' , multiple = True ,
201
+ @click .option ('--delegate' , 'delegates' , metavar = 'DELEGATE' , multiple = True ,
202
202
help = 'Show only patches with these delegates. Should be an '
203
203
'email or username.' )
204
204
@click .option ('--hash' , 'hashes' , metavar = 'HASH' , multiple = True ,
@@ -209,34 +209,43 @@ def update_cmd(patch_ids, commit_ref, state, delegate, archived, fmt):
209
209
@utils .format_options (headers = _list_headers )
210
210
@click .argument ('name' , required = False )
211
211
@api .validate_multiple_filter_support
212
- def list_cmd (state , submitter , delegate , hashes , archived , limit , page , sort ,
213
- fmt , headers , name ):
212
+ def list_cmd (states , submitters , delegates , hashes , archived , limit , page ,
213
+ sort , fmt , headers , name ):
214
214
"""List patches.
215
215
216
216
List patches on the Patchwork instance.
217
217
"""
218
218
LOG .debug ('List patches: states=%s, submitters=%s, delegates=%s, '
219
- 'hashes=%s, archived=%r' , ',' .join (state ), ',' .join (submitter ),
220
- ',' .join (delegate ), ',' .join (hashes ), archived )
219
+ 'hashes=%s, archived=%r' , ',' .join (states ), ',' .join (submitters ),
220
+ ',' .join (delegates ), ',' .join (hashes ), archived )
221
221
222
222
params = []
223
223
224
- for state in state :
224
+ for state in states :
225
225
params .append (('state' , state ))
226
226
227
- for subm in submitter :
228
- # we support server-side filtering by email (but not name) in 1.1
229
- if (api .version () >= (1 , 1 ) and '@' in subm ) or subm .isdigit ():
230
- params .append (('submitter' , subm ))
227
+ for submitter in submitters :
228
+ if submitter .isdigit ():
229
+ params .append (('submitter' , submitter ))
231
230
else :
232
- params .extend (api .retrieve_filter_ids ('people' , 'submitter' , subm ))
233
-
234
- for delg in delegate :
235
- # we support server-side filtering by username (but not email) in 1.1
236
- if (api .version () >= (1 , 1 ) and '@' not in delg ) or delg .isdigit ():
237
- params .append (('delegate' , delg ))
231
+ # we support server-side filtering by email (but not name) in 1.1
232
+ if api .version () >= (1 , 1 ) and '@' in submitter :
233
+ params .append (('submitter' , submitter ))
234
+ else :
235
+ params .extend (
236
+ api .retrieve_filter_ids ('people' , 'submitter' , submitter ))
237
+
238
+ for delegate in delegates :
239
+ if delegate .isdigit ():
240
+ params .append (('delegate' , delegate ))
238
241
else :
239
- params .extend (api .retrieve_filter_ids ('users' , 'delegate' , delg ))
242
+ # we support server-side filtering by username (but not email) in
243
+ # 1.1
244
+ if api .version () >= (1 , 1 ) and '@' not in delegate :
245
+ params .append (('delegate' , delegate ))
246
+ else :
247
+ params .extend (
248
+ api .retrieve_filter_ids ('users' , 'delegate' , delegate ))
240
249
241
250
for hash_ in hashes :
242
251
params .append (('hash' , hash_ ))
0 commit comments