octo.nvim
octo.nvim copied to clipboard
Improve the `Octo pr list` command
Describe what this PR does / why we need it
This PR includes improvements to the pr list command. Specifically:
- it changes the fetch implementation to one based on REST rather than GraphQL, since GraphQL lacks several important features, such as the ability to filter on authors or assignees or labels.
- it abandons the attempt to fetch all PRs via pagination, since repos with hundreds or even thousands of PRs will cause this to be inefficient or unusable
- it changes the display in telescope of PRs to show authors and branches, and allows the user to filter based on these values. This is very important in organizations where practices such as including ticket IDs in branch names are followed.
Does this pull request fix one issue?
Fixes #551
Describe how you did it
The main changes are in pickers/telescope/entry_maker.lua and pickers/telescope/provider.lua. These files define both the mechanism for retrieving pull requests and how they are passed to the telescope picker.
A new function gen_from_pull_request is added in entry_maker.lua to handle the display of the pull request data, including the addition of the new author and branch columns. The ordinal for pull requests now includes the author and branch information, allowing this to be used in filtering (displaying this is not enough).
The retrieval is changed in telescope/provider.lua (specifically in the pull_requests function). Here we call gh pr list rather than using the exisiting GraphQL implementation in order to provide access to the additional features that allows.
The retrieved records are modified to conform to the GraphQL result schema, meaning that they can be used in existing functions if necessary.
Describe how to verify it
The following actions will be useful in verification:
- run
Octo pr listand then use telescope to filter by author name - run
Octo pr list author=@meand see that only your PRs are shown
Special notes for reviews
Thanks for the PR! added a few comments
Thank you! FWIW this works fine for me with the suggested patch.
Hey @alexkalderimis can you take a look at the review comments and patch provided by @legobeat ?
@alexkalderimis hi there, are you going to move this forward? if not, I can try to address the comments.
If you need any support, feel free to tag me. I will be happy to help where I can!
Resubmitted this with feedback addressed in #635
Hi everyone - sorry about dropping the ball on this. I will address these comments and get this ready to merge