Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open PR associated with blame #81

Open
dev-ardi opened this issue Apr 29, 2024 · 3 comments
Open

Open PR associated with blame #81

dev-ardi opened this issue Apr 29, 2024 · 3 comments

Comments

@dev-ardi
Copy link

If I blame a line I get the associated commit. Then I have to yank it and copy it into https://github.com/foo/bar/commit/abcd123 and click on the PR.

It would be nice if I could do this directly from the editor.

@shumphrey
Copy link

I also have a simiar workflow where I want to open the PR that merged a particular commit.
I used to use git when-merged but realising that GitHub has an api for finding the PR, I wrote a plugin to do that.

GitHub API docs for listing PRs associated with a commit (note that there can be more than 1)
https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit

I structured it in a similar way to how rhubarb interfaces with GitHub, with the idea that I could maybe move parts of the logic to rhubarb/fugitive-gitlab and other parts to fugitive.
That would allow fugitive to control the commands/bindings and git, with the logic for obtaining the url delegated to rhubarb/fugitive-gitlab.
I'm in two minds as to whether its worth it though.

Anyway, my plugin demonstrates how this could work for both GitHub/rhubarb and GitLab/fugitive-gitlab
https://github.com/shumphrey/vimrc/blob/master/plugin/mergerequest.vim

@tpope
Copy link
Owner

tpope commented Nov 14, 2024

If I blame a line I get the associated commit. Then I have to yank it and copy it into https://github.com/foo/bar/commit/abcd123

This is just :GBrowse with extra steps.

and click on the PR.

So this feature request boils down to saving you a click. That's not nothing; I do this operation a lot myself so I see the appeal. But I'm inclined to think it doesn't justify adding a whole top level command to Fugitive.

@shumphrey
Copy link

There is the potential for saving a few more clicks/commands if there's a command to bypass blame and go straight from current line to PR that introduced that line.
But I don't disagree adding an entirely new set of commands for this seems like overkill.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants