pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Commit-wise PR review shows at most 30 commits

Eryx5502 opened this issue · comments

Issue Description

Type: bug report
There is an spurious limit of 30 on the list of commits from a PR (at least on the commit-wise pr review list).

Describe what happened (or what feature you want)

When using :Octo review commit, the list of commits displayed has at most 30 entries. If the PR has more than 30 commits, only the 30 oldest commits are shown (+ the [[ENTIRE PULL REQUEST]] option with the last commit).

Describe what you expected to happen

Either all the commits of the PR are shown (optimal solution from my perspective), or a configuration should allow to fix a higher number of PR commits to consider, or the :Octo review commit accepts a commit sha.

How to reproduce it (as minimally and precisely as possible)

  1. Call :Octo review commit on a PR with more than 30 commits

Tell us your environment

NVIM 0.10.0-dev inside WSL2

Anything else we need to know?

I believe the problem comes from the github api call. I am not fully familiar with Octo code, but after a quick search I think you get the list of commits from the /repos/{owner}/{repo}/pulls/{pull_number}/commits endpoint. The response is paginated with a default per_page equal to 30, which I think is what limits the displayed number of commits. One would need to either increase the per_page value (max accepted is 100) or iterate the pages for getting all the commits.

Same for Octo pr changes. Only 30 changes are visible on the panel.

Thanks for reporting, can you please check if the issue gets fixed with #475?

Just tried and while it works for :Octo pr commits, it does nothing when :Octo review commit. It doesn't yield any error message or anything.

Seems to be working for me, at least in PRs with less than 30 commits. Do you have any public PR at hand with more than 30 commits to try?

When I review that PR, Octo commit review shows the 118 commits:

Image

Picking one it, it correctly shows the only 5 files changed in that commit:

Image

Are you getting a different behavior?

I'm not getting anything after doing :Octo review commit. Not sure what to try to find the reason why... Just checking... Today I just updated plugins... Is your Telescope up to date with the master branch? I'm having other random issues with Telescope after the update...

I just updated telescope and fzf-lua, tried with both pickers and both of them show the lists of commits

How can I debug what's going on? Also, is something wrong with this config?

{
    "pwntester/octo.nvim",
    branch = "fix_459",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-telescope/telescope.nvim",
      "nvim-tree/nvim-web-devicons",
    },
    config = function()
      require("octo").setup({
        enable_builtin = true,
        use_local_fs = true,
        mappings = {
          issue = {
            close_issue = { lhs = "<localleader>ic", desc = "close issue" },
            reopen_issue = { lhs = "<localleader>io", desc = "reopen issue" },
            list_issues = { lhs = "<localleader>il", desc = "list open issues on same repo" },
            reload = { lhs = "<C-r>", desc = "reload issue" },
            open_in_browser = { lhs = "<C-b>", desc = "open issue in browser" },
            copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
            add_assignee = { lhs = "<localleader>aa", desc = "add assignee" },
            remove_assignee = { lhs = "<localleader>ad", desc = "remove assignee" },
            create_label = { lhs = "<localleader>lc", desc = "create label" },
            add_label = { lhs = "<localleader>la", desc = "add label" },
            remove_label = { lhs = "<localleader>ld", desc = "remove label" },
            goto_issue = { lhs = "<localleader>gi", desc = "navigate to a local repo issue" },
            add_comment = { lhs = "<localleader>ca", desc = "add comment" },
            delete_comment = { lhs = "<localleader>cd", desc = "delete comment" },
            next_comment = { lhs = "<localleader>cj", desc = "go to next comment" },
            prev_comment = { lhs = "<localleader>ck", desc = "go to previous comment" },
            react_hooray = { lhs = "<localleader>rp", desc = "add/remove 🎉 reaction" },
            react_heart = { lhs = "<localleader>rh", desc = "add/remove ❤️ reaction" },
            react_eyes = { lhs = "<localleader>re", desc = "add/remove 👀 reaction" },
            react_thumbs_up = { lhs = "<localleader>r+", desc = "add/remove 👍 reaction" },
            react_thumbs_down = { lhs = "<localleader>r-", desc = "add/remove 👎 reaction" },
            react_rocket = { lhs = "<localleader>rr", desc = "add/remove 🚀 reaction" },
            react_laugh = { lhs = "<localleader>rl", desc = "add/remove 😄 reaction" },
            react_confused = { lhs = "<localleader>rc", desc = "add/remove 😕 reaction" },
          },
          pull_request = {
            checkout_pr = { lhs = "<localleader>po", desc = "checkout PR" },
            merge_pr = { lhs = "<localleader>pm", desc = "merge commit PR" },
            squash_and_merge_pr = { lhs = "<localleader>psm", desc = "squash and merge PR" },
            list_commits = { lhs = "<localleader>pc", desc = "list PR commits" },
            list_changed_files = { lhs = "<localleader>pf", desc = "list PR changed files" },
            show_pr_diff = { lhs = "<localleader>pd", desc = "show PR diff" },
            add_reviewer = { lhs = "<localleader>va", desc = "add reviewer" },
            remove_reviewer = { lhs = "<localleader>vd", desc = "remove reviewer request" },
            close_issue = { lhs = "<localleader>ic", desc = "close PR" },
            reopen_issue = { lhs = "<localleader>io", desc = "reopen PR" },
            list_issues = { lhs = "<localleader>il", desc = "list open issues on same repo" },
            reload = { lhs = "<C-r>", desc = "reload PR" },
            open_in_browser = { lhs = "<C-b>", desc = "open PR in browser" },
            copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
            goto_file = { lhs = "gf", desc = "go to file" },
            add_assignee = { lhs = "<localleader>aa", desc = "add assignee" },
            remove_assignee = { lhs = "<localleader>ad", desc = "remove assignee" },
            create_label = { lhs = "<localleader>lc", desc = "create label" },
            add_label = { lhs = "<localleader>la", desc = "add label" },
            remove_label = { lhs = "<localleader>ld", desc = "remove label" },
            goto_issue = { lhs = "<localleader>gi", desc = "navigate to a local repo issue" },
            add_comment = { lhs = "<localleader>ca", desc = "add comment" },
            delete_comment = { lhs = "<localleader>cd", desc = "delete comment" },
            next_comment = { lhs = "<localleader>cj", desc = "go to next comment" },
            prev_comment = { lhs = "<localleader>ck", desc = "go to previous comment" },
            react_hooray = { lhs = "<localleader>rp", desc = "add/remove 🎉 reaction" },
            react_heart = { lhs = "<localleader>rh", desc = "add/remove ❤️ reaction" },
            react_eyes = { lhs = "<localleader>re", desc = "add/remove 👀 reaction" },
            react_thumbs_up = { lhs = "<localleader>r+", desc = "add/remove 👍 reaction" },
            react_thumbs_down = { lhs = "<localleader>r-", desc = "add/remove 👎 reaction" },
            react_rocket = { lhs = "<localleader>rr", desc = "add/remove 🚀 reaction" },
            react_laugh = { lhs = "<localleader>rl", desc = "add/remove 😄 reaction" },
            react_confused = { lhs = "<localleader>rc", desc = "add/remove 😕 reaction" },
          },
          review_thread = {
            goto_issue = { lhs = "<localleader>gi", desc = "navigate to a local repo issue" },
            add_comment = { lhs = "<localleader>ca", desc = "add comment" },
            add_suggestion = { lhs = "<localleader>sa", desc = "add suggestion" },
            delete_comment = { lhs = "<localleader>cd", desc = "delete comment" },
            next_comment = { lhs = "<localleader>cj", desc = "go to next comment" },
            prev_comment = { lhs = "<localleader>ck", desc = "go to previous comment" },
            select_next_entry = { lhs = "<localleader>k", desc = "move to previous changed file" },
            select_prev_entry = { lhs = "<localleader>k", desc = "move to next changed file" },
            close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
            react_hooray = { lhs = "<localleader>rp", desc = "add/remove 🎉 reaction" },
            react_heart = { lhs = "<localleader>rh", desc = "add/remove ❤️ reaction" },
            react_eyes = { lhs = "<localleader>re", desc = "add/remove 👀 reaction" },
            react_thumbs_up = { lhs = "<localleader>r+", desc = "add/remove 👍 reaction" },
            react_thumbs_down = { lhs = "<localleader>r-", desc = "add/remove 👎 reaction" },
            react_rocket = { lhs = "<localleader>rr", desc = "add/remove 🚀 reaction" },
            react_laugh = { lhs = "<localleader>rl", desc = "add/remove 😄 reaction" },
            react_confused = { lhs = "<localleader>rc", desc = "add/remove 😕 reaction" },
          },
          submit_win = {
            approve_review = { lhs = "<C-a>", desc = "approve review" },
            comment_review = { lhs = "<C-m>", desc = "comment review" },
            request_changes = { lhs = "<C-r>", desc = "request changes review" },
            close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
          },
          review_diff = {
            add_review_comment = { lhs = "<localleader>ca", desc = "add a new review comment" },
            add_review_suggestion = { lhs = "<localleader>sa", desc = "add a new review suggestion" },
            focus_files = { lhs = "<localleader>e", desc = "move focus to changed file panel" },
            toggle_files = { lhs = "<localleader>b", desc = "hide/show changed files panel" },
            next_thread = { lhs = "<localleader>tj", desc = "move to next thread" },
            prev_thread = { lhs = "<localleader>tk", desc = "move to previous thread" },
            select_next_entry = { lhs = "<localleader>j", desc = "move to previous changed file" },
            select_prev_entry = { lhs = "<localleader>k", desc = "move to next changed file" },
            close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
            toggle_viewed = { lhs = "<localleader><localleader>", desc = "toggle viewer viewed state" },
            goto_file = { lhs = "gf", desc = "go to file" },
          },
          file_panel = {
            next_entry = { lhs = "j", desc = "move to next changed file" },
            prev_entry = { lhs = "k", desc = "move to previous changed file" },
            select_entry = { lhs = "<cr>", desc = "show selected changed file diffs" },
            refresh_files = { lhs = "R", desc = "refresh changed files panel" },
            focus_files = { lhs = "<localleader>e", desc = "move focus to changed file panel" },
            toggle_files = { lhs = "<localleader>b", desc = "hide/show changed files panel" },
            select_next_entry = { lhs = "<localleader>j", desc = "move to previous changed file" },
            select_prev_entry = { lhs = "<localleader>k", desc = "move to next changed file" },
            close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
            toggle_viewed = { lhs = "<localleader><localleader>", desc = "toggle viewer viewed state" },
          },
        },
      })
      vim.cmd([[hi OctoEditable guibg=none]])
    end,
    keys = {
      { "<leader>o", "<cmd>Octo<cr>", desc = "Octo.nvim" },
    },
    cmd = { "Octo" },
  }

Alright, I was just being dumb. Didn't realise I needed to start a review first. Somehow I expected :Octo review commit to start a new review, which it doesn't (and it makes sense it doesn't, although it might be worth it to add a warning for users in case someone else tries in the future).

I can confirm it does work as expected now and PR #475 appears to solve this issue. Thanks for the work! <3

Thanks, I have added some error messages in #475 to make it more clear.