-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
possible to merge PR's from magit? #96
Comments
You have to checkout a local branch for the pr first ( I have decided to not add a command to merge without creating a branch first because I think its a good thing to do some review in Magit before doing so. On the other hand since the pr's commits are now listed when viewing the pr, that is possible without creating a branch first. Then again you might want to rebase and/or make small changes and for that you need a branch. Please try using the "create branch and then merge that" approach for a while and let me know how it works out for you.
Thanks! |
ok thank, I see now how to do it, I'll try for a while.
by review you mean just reviewing the code in one's own environment, rihgh? Only asking because I use github code reviews for student work and if I could do those from Emacs it would be one less reason to ever leave. |
rihgh :-)
And you are talking about those "new" inline reviews, right? Like what I have done for #90? Forge doesn't support that yet and I have to admit that I never quiet got used to that feature. I got the impression that it makes it hard to keep track of "obsolete" discussions after a new iteration was force-pushed. So I am trying to force myself to use that feature more now. Maybe you could share your experience? For example how do you verify that "I have taken all your feedback into account" actually is true? The plan currently is to convert inline comments to Git notes and to use "iteration N of pull-request P" refs to avoid loosing "obsolete" reviews, but that will be quite difficult to implement. |
:-) I also find the feature not completely helpful. but it is an easy way to comment directly on one or more lines of someone's code. This allows me to discuss exactly what kind of error the student is making. This can of course be done in an ordinary comment, but then I have to cut and paste the relevant lines and enclose them in a markdown code block with the language identifier... that becomes a little tiresome. If there was a way to grab a chunk of code with line numbers from the diff view in Magit? If so, then it might be more straightforward to include the code review directly into the PR itself when it gets created, or in a later comment. |
I'd love to know this too, because I frequently experience that the GitHub inline comments are left unaddressed, presumably because they disappear too quickly if you change something else nearby. |
well, this is an excellent point. Since I mostly use this feature to give students feedback on their assignments, it's not really my responsibility to make sure that the problems have been addressed. On the other hand, I spend some time in another project where people do seem to use the line-by-line review pretty successfully: https://github.com/edgi-govdata-archiving . However, this is in the context of a group of people who are working closely together. So the line-by-line review is more along the lines of a conversation, than, say, a formal requirement. On this last assignment I tried to just quickly shift back and forth between an org-mode buffer with student comments, and a diff buffer (diff between student work handed in, and original state of the assignment). I copy the lines I'm interested in over to an org-mode source block and write comments there. That method works OK. It's a bit awkward and involves quite a few keystrokes. I might be able to make things easier by writing a few simple functions and giving them keybindings, but I haven't really thought about how best to manage the workflow. Hopefully that is a little bit of an explanation.... What do you do when you need to comment on individual lines or functions in a PR? |
I tend to use inline comments quite a bit, but because of the problem I mentioned above, if there's something I really want them to change I mention it also in the general comments section, e.g. "Approved on the assumption that X will be addressed". |
We use the review functionality extensively.
Well, we don't really let the review system enforce that, as you've pointed out it really doesn't. We assume that everybody is grown enough to read all comments and act appropriately. We use the approved/changes requested status of the review to give an overall sort of pass/fail, but for things that doesn't actually break something we'll approve with comments and let the developer decide if it's passable or if they'll address the comments. I'd like to be able to see the comments and reply to them, and set the overall review status. Being able to see the comments in the original file (with collapsible markers) would be awesome for bigger reviews where you're jumping around, so you always knows where you've commented, but that's a bit more involved. |
Just thought I'd note that there's a new package github-review that allows at least preliminary editing of code reviews in Emacs, and as of the last day or so hooks into forge. I haven't used it much yet but it seems like a promising start. |
I would like to jump in this conversation as I have been trying the Overall it's fine from a git perspective, however I have some context missing in the merge commit message. Indeed when I merge from Github, the merge commit looks like:
When I merge manually with Magit the merge commit looks like:
I believe WDYT? |
Doing this did require any major changes. Using the same message as Github would be complicated, so I am not doing that. |
So:
|
Am finally trying this workflow and am not sure I have it right. Is there a final step that causes the PR to be closed? |
Pushing to It's important that you push the pr branch before |
Ah ok. Am I supposed to merge into master or origin/master?
|
The former, not least because the latter is not possible. It's not possible to check out a so called remote-tracking branch (i.e. a local ref (usually in the You can checkout the commit that So the expected workflow is:
|
Can we change the i.e. the actual |
@asymmetric Could you please point me to an instance where Github fails to do the current format so that I can confirm that without having to setup a test repository just for that purpose. |
@tarsius sure, here you go. For comparison, this is the standard GitHub format. |
I've added the number sign. I think that always was the intention. |
@tarsius can't see any new commits yet, are you planning on pushing the changes later? |
The change was to Magit: magit/magit@2dd12b2. |
@tarsius I totally agree you should pull in PRs locally to review. However, my organization disallows direct pushing to the mainline repo; that's an option in the branch protection settings if you pay GitHub for it. The only way to merge a PR is explicitly on the website or through the API after an accepted review. So, that's a counter-point to having an inability to edit the status to merged. What are your thoughts on this issue? |
Well, you asked:
That's awful. Github creates somewhat corrupted commits by default. The message does not end with newline as it is supposed to. In some cases it claims "github" was the committer. It does not simply fast-forward when it should do so. Etc...
"counter-point to [...] an inability" Uhuh. I think what you are saying is: Since some people cannot use the recommended workflow would you reconsider adding a command that performs the merge using the API?. To which my answer is: I can write that command and post it here, but I don't want to add it to the package. Doing that would encourage people to use it even when that is not necessary and since I have such a low opinion about how github performs merges I really don't want that to happen. |
Yeah, that's all fair, @tarsius. I completely agree with you. Thanks for your thoughts! I'd rather we just pushed if we can figure out a nice way to do it. I don't know much about the Github API or ghub. Is it possible to automate better merge messages (newlines at the end, fast-forward only, etc) and maintain these branch protection rules? To be clear, I'm not necessarily asking you to make any changes, just exploring the options. 👍 For context: My company actually just switched from Mercurial to git+github, so we're still figuring this stuff out. I'm worried about giving out |
@wraithm |
Yeah, @xendk. You're totally right. Force pushes can be disallowed! That's great. Okay. Nevermind about my questions then. |
I have a similar issue to @wraithm - except that my company uses GitLab internally not GitHub. The primary repo my team works with is configured to prevent remote pushes directly to master. There are good reasons for that and it's not going to change, so at the moment the only way to get changes into master is to push a branch (which creates a merge request and kicks off CI pipelines) then use the web interface to merge it. It's not a show-stopper, and I'm still in a much better place with magit and forge than without, but it would be really nice to be able to manage GitLab MRs with labels etc. and work within our established workflow directly from Emacs. Thanks. |
I, too, like 'forge' quite a lot. Many thanks for this extremely I, too, would like to be able to merge pull requests without having to
Is there any hope of an evolution here? |
I actually started working on this in January (on the |
Thanks a lot for your response, Jonas!
To me the good news is way more important than the bad one, there is no
hurry on my side so please don't feel any pressure!
Will you report back here when something is ready, even if it's to
request testing?
Would be happy to try it out!
|
Yes. And I am reopening this issue so I won't forget. |
Jonas Bernoulli (2021/04/03 03:58 -0700):
> Will you report back here when something is ready, even if it's to request testing?
Yes. And I am reopening this issue so I won't forget.
Many thanks, that's great and lovely from you.
|
I've added a new |
Certain transient popups hide some of their suffix commands by default. These additional suffixes can be enabled interactively. TL;DR Enter the transient as usual and type C-x l. This is a canned response; it may not apply 100% in this case. |
Jonas Bernoulli (2021/06/19 13:02 -0700):
I've added a new `forge-merge` command to the `magit-merge` popup.
It's only marginally more advanced than the minimal viable
implementation but might proof useful anyway.
Many thanks! Will try to provide feedback!
|
This feature is great. Thanks! |
I s it possible to merge PR's (in my case, Github PR's) from magit? I had the impression in the Forge announcement that it was:
But I can't find mention of it in the docs or in the code.
Also just in passing forge continues to be my biggest quality-of-life improvement of 2019!
The text was updated successfully, but these errors were encountered: