Conversation
It can be useful to merge existing PRs locally to test them, etc. Add a function and a pop-up binding to do this. Fixes vermiculus#14
|
Two possible problems with this PR:
|
|
This looks awesome! I'll have to take a look at this tonight (and read up on I wouldn't say this PR properly fixes #14 since I can definitely see a use case for just wanting to fetch the branch, but this PR would still be very useful to merge as-is. I'll keep you posted. |
|
Alright, I've been thinking about this. Is there any way we can integrate this into Magit's natural workflows? (defun magit-am-apply-maildir (&optional maildir args)
"Apply the patches from MAILDIR."
(interactive (list (read-file-name "Apply mbox or Maildir: ")
(magit-am-arguments)))
(magit-run-git-sequencer "am" args (expand-file-name maildir))) |
|
@tarsius How sad would you be if a precedent was set for plugins inserting themselves into internal popups like |
| (interactive (list (magit-section-value | ||
| (magit-current-section)))) | ||
| (magithub--command-output "am" `("-3" ,(plist-get issue :url))) | ||
| (magithub-issue-refresh)) |
There was a problem hiding this comment.
Out of curiosity, why was this necessary? If we're applying the merge locally, that shouldn't impact GitHub's data.
| (?f "Fork" magithub-fork-popup) | ||
| (?i "Issues" magithub-issues-popup) | ||
| (?p "Submit a pull request" magithub-pull-request-popup) | ||
| (?m "Merge a pull request locally" magithub-pr-merge-locally) |
There was a problem hiding this comment.
I do agree this is pretty strange. It'd be nice to have this as actionable from the pull-request itself. This popup seems more oriented to actions that are 'original sins' in a way (with the possible exception of submitting a pull request being based on a branch).
| "Merges `issue' locally using `hub am -3'." | ||
| (interactive (list (magit-section-value | ||
| (magit-current-section)))) | ||
| (magithub--command-output "am" `("-3" ,(plist-get issue :url))) |
There was a problem hiding this comment.
Also, -3 looks like it's something that can be overridden with git config variables. Should we not respect the user's preferences?
All this could be mitigated by using magit's am sequencer.
| (plist-get issue :url) | ||
| (car (magithub--command-output "browse" '("--url-only" "--" "issues")))))) | ||
|
|
||
| (defun magithub-pr-merge-locally (issue) |
There was a problem hiding this comment.
The module/package/namespace is magithub-issue, so this would rather be named something like magithub-issue-merge-pr-locally.
|
I've written some API as part of a real, concise fix to #14. It could be useful here: 23d7b72 For instance, here's an implementation using more of magit's stuff and the new utility functions: (defun magithub-pull-request-merge (pull-request &optional args)
"Merge PULL-REQUEST with ARGS.
See `magithub-pull-request--completing-read'. If point is on a
pull-request object, that object is selected by default."
(interactive (list (magithub-pull-request--completing-read)
(magit-am-arguments)))
(unless (member pull-request (magithub-pull-requests))
(user-error "Unknown pull request %S" pull-request))
(magithub-with-hub
(magit-run-git-sequencer "am" args (plist-get pull-request :url)))) |
I have no objections to that, but would like to ask you to provide an option to keep |
|
Would interactive functions like |
|
Maybe I'm missing what you're proposing but I don't think additional configuration should be required to be able to merge in pull requests... Seems like the sort of batteries that should be included in a github PR management package... |
|
@mgalgs The interactive functions would still exist -- they just wouldn't be completely integrated into Magit's popups. The goal of Magithub was to be a truly integrated plugin for GitHub-related tasks -- I'd rather not completely separate it from Magit's established workflows. FWIW though, ever since #49 I've been thinking about a completing-read index of integration points that can be accessed from the dispatcher -- to help discoverability. |
|
Don't mean to add noise, but originally I thought this was a feature of magithub and when I found out it wasn't I found this. Glad it's being worked on! Any updates? |
|
@blaenk I'll see what I can do about getting a magit-integrated solution into master by the new year, but it will not be batteries included per Jonas' request. I'll probably have to include some sort of message saying something like 'magithub not fully setup' when magit starts and magithub is turned on (which turned off by, say, |
|
Sorry for the mess with issues/comments. I too got confused about this PR and what it aimed to do. This looks nice, but I personally would also like to see a feature to simply fetch/checkout PR changes into their own branch, preferably with the choice of 2 strategies: 1) adding the PR source remote and checking out the PR branch and 2) fetching the PR ref github creates for the PR. Then I can simply use magit/git to merge the branch if I want to. See this comment on #14 for more information about what I mean. |
It can be useful to merge existing PRs locally to test them, etc. Add a
function and a pop-up binding to do this.
Fixes #14