octo.nvim icon indicating copy to clipboard operation
octo.nvim copied to clipboard

Improve the `Octo pr list` command

Open alexkalderimis opened this issue 1 year ago • 6 comments

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 list and then use telescope to filter by author name
  • run Octo pr list author=@me and see that only your PRs are shown

Special notes for reviews

alexkalderimis avatar May 23 '24 15:05 alexkalderimis

Thanks for the PR! added a few comments

pwntester avatar Jun 09 '24 18:06 pwntester

Thank you! FWIW this works fine for me with the suggested patch.

legobeat avatar Jul 09 '24 18:07 legobeat

Hey @alexkalderimis can you take a look at the review comments and patch provided by @legobeat ?

pwntester avatar Sep 10 '24 20:09 pwntester

@alexkalderimis hi there, are you going to move this forward? if not, I can try to address the comments.

macovsky avatar Oct 13 '24 15:10 macovsky

If you need any support, feel free to tag me. I will be happy to help where I can!

williambdean avatar Oct 13 '24 19:10 williambdean

Resubmitted this with feedback addressed in #635

legobeat avatar Oct 14 '24 00:10 legobeat

Hi everyone - sorry about dropping the ball on this. I will address these comments and get this ready to merge

alexkalderimis avatar Apr 17 '25 21:04 alexkalderimis