Skip to content

Commit

Permalink
patch: Fix filtering by state
Browse files Browse the repository at this point in the history
The '--state' parameter wasn't doing anything. Correct this, and set a
sensible default corresponding to the default list of 'action_required'
states found in Patchwork.

Signed-off-by: Stephen Finucane <[email protected]>
Closes-bug: #8
  • Loading branch information
stephenfin committed Jan 11, 2018
1 parent 8eeed51 commit 9629d86
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions git_pw/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,16 @@ def update_cmd(patch_id, commit_ref, state, delegate, archived):
_show_patch(patch)


# NOTE(stephenfin): The list of default states is populated from Patchwork's
# 'fixtures/default_states.xml' file [1]. Due to bug #156, we can only
# currently filter by one state but we've configured this for future support of
# multiple states.
#
# [1] https://git.io/vN3vi
# [2] https://git.io/vN3vX
@click.command(name='list')
@click.option('--state', metavar='STATE', multiple=True,
default=['under-review', 'new'],
help='Show only patches matching these states. Should be '
'slugified representations of states. The available states '
'are instance dependant.')
Expand Down Expand Up @@ -189,6 +197,9 @@ def list_cmd(state, submitter, delegate, archived, limit, page, sort, name):

params = []

for state in state:
params.append(('state', state))

# TODO(stephenfin): It should be possible to filter patches submitter email
for subm in submitter:
people = api.index('people', {'q': subm})
Expand Down

0 comments on commit 9629d86

Please sign in to comment.