Repository navigation
Conversation
'pwclient list STR' passes the name to 'REST.patch_list', but the REST backend dropped it and listed all patches. Patchwork's patch list endpoint searches patch names with the 'q' parameter, so pass it there, as the XML-RPC backend already does with 'name__icontains'. Closes: getpatchwork#51 Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #51.
I started from #51 and checked it against the code.
pwclient listtakes the name as the positionalSTRargument, andshell.pypasses it topatch_list(name=...). The XML-RPC backend turns it intoname__icontains, butREST.patch_listnever adds it to the request, so with the REST backend (now the default) every patch of the project is listed.Patchwork's patch list endpoint searches patch names with the
qparameter (search_fields = ('name',)inPatchList, and theqSearch parameter in the API schema for/api/1.0/patches). This change adds the name asqto the filters.How I found it
I compared the two
patch_listimplementations inpwclient/api.py: the XML-RPC one handlesname, the REST one skips it. Then I checked the server side on patchwork.ozlabs.org:/api/1.0/patches/?project=patchworkreturns unrelated patches, and adding&q=pwclientreturns only patches with "pwclient" in the name.Where this can show up in practice
Anyone who runs
pwclient list <name>to find a patch by its subject, for example to get its ID forpwclient git-am, gets the full patch list of the project instead, which on a busy project is a long list with no sign that the filter was ignored. This is my estimate beyond the report in #51.Testing
test_rest_client__patch_list__nameintests/test_api.py: checks thatpatch_list(name='foo')sendsq=foo. It fails without the change.pytest: 90 passed (Python 3.12).pwclient list -p patchwork "git-am action"returns only patch 127647 ("patchwork: new pwclient git-am action").toxand the pre-commit hooks.