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

Navigate through MR by commit

Open sankargorthi opened this issue 11 months ago • 3 comments

Feature Description

Gitlab MRs currently allow for reviewing changes made on each commit and commenting on specific SHAs. Providing a way of focusing on a specific commit could help with reviews that involve well-constructed incremental changes.

sankargorthi avatar Jan 08 '25 18:01 sankargorthi

Hi @sankargorthi, this sounds like a good idea but also like quite a lot of work. Is there any chance you'd like to create a PR for this?

We could probably use something like :DiffviewFileHistory --range=origin..HEAD to get the relevant commit history in the reviewer. The tricky part would be to make this "mode" to work interchangeably with how it works now with :DiffviewOpen <base_sha>..<head_sha>. I imagine ideally we'd like to be able to switch between these two modes on the fly without restarting Neovim and changing the gitlab.nvim config.

It'd be necessary to make changes around how the Diffview state is handled, how it interacts with the discussion tree (e.g., jumping to file could now respect the revision thus improving the UX related to issue #451), how comments are created (we'd need to find out the currently selected revision and include it into the Gitlab API call, and find out about Gitlab intricacies like that it doesn't support suggestions on old versions in a diff for two commits).

jakubbortlik avatar Jan 08 '25 22:01 jakubbortlik

Thanks for fleshing out the implementation roadmap! That is definitely a lot of work and I have no experience with Go; it'd be a tall order. Was just hoping for a stopgap solution of going to the commit log and :DiffviewOpen <current_sha>~..<current_sha>, but easier said than done I suppose.

sankargorthi avatar Jan 09 '25 05:01 sankargorthi

I don't think you'd have to do any changes to the Go code, just Lua. But I admit it would still be hard without previous knowledge of the codebase. I think the feature would be useful but I'm currently working on different improvements of the plugin so I may get to this one later.

jakubbortlik avatar Jan 09 '25 10:01 jakubbortlik