Closed alexfikl closed 2 years ago
I didn't know bitbucket has query and sort support on this. I'd like to utilize this instead of paging, like the github source does.
I didn't know bitbucket has query and sort support on this. I'd like to utilize this instead of paging, like the github source does.
Not super familiar with the bitbucket API, but it seems like the results are always paginated, even when sorted or filtered.
I can definitely use the sorted results to get a latest tag like the github plugin. Is that what you meant? EDIT: Gave it a go in e6012b8. Let me know what you think!
I want to expose the q
and sort
parameters from the API to the configuration, and we only return results on the first page. Hopefully the desired tag can be q
ueried and sort
ed to be on the first page, and any outliners can be filtered using the "list options" mechanism.
We may add three new options: use_sorted_tags
(not latest
since we can sort differently) means to use this new behavior and optional query
and sort
can be provided, and we pass those directly to bitbucket's API.
(However the old behavior needs to be kept for backward compatibility.)
I want to expose the
q
andsort
parameters from the API to the configuration, and we only return results on the first page. Hopefully the desired tag can beq
ueried andsort
ed to be on the first page, and any outliners can be filtered using the "list options" mechanism.We may add three new options:
use_sorted_tags
(notlatest
since we can sort differently) means to use this new behavior and optionalquery
andsort
can be provided, and we pass those directly to bitbucket's API.(However the old behavior needs to be kept for backward compatibility.)
Tried do implement something like that in a8228bb. It seems to work for the simple tests I played with. What do you think?
There are a few other things we can add to the query:
fields=values.name
tells bitbucket to only return the tag names (as that's all we use anyway). This could be always added?pagelen=NUMBER
can return more results (default is just 10). This could be a config option like max_page
?pagelen
. max_page
is for repos with a lot of unwanted tags, but since we can sort and filter, it should be unlikely we need a large pagelen
to get what we want. Users can open an issue if it's actually useful.
- Yes, the smaller the response is, the faster it works.
Added support for this in the latest commit and fixed the mypy issues (at least locally, fingers crossed!).
Make better use of the bitbucket API to sort tags:
q="my_query"
to narrow down the results. This does not support fancy regex queries, justcontains
and comparisons.sort=field
to sort the results by the given field.fields=values.name,next
to only return relevant data.