magithub icon indicating copy to clipboard operation
magithub copied to clipboard

Set reviewer and assignee when creating PR

Open mpolden opened this issue 6 years ago • 7 comments

When creating a pull request using hub, it's possible to set reviewers and and assignees at the time the PR is created.

hub pull-request -r [reviewer] -a [assignee]

It would be great to have this feature in magithub. Right now, the time I save by creating PRs from Emacs is lost because I still have to open the PR in my browser to assign reviewers.

Thanks for creating this package, I've missed using GitHub features from Magit!

mpolden avatar May 03 '18 07:05 mpolden

IIRC you do need to assign reviewers manually still (not for long!) but you can assign…assignees from the status buffer (or anywhere you see this field):

Head:     64e1a6c bleep test commit
Merge:    bcb23d2 yabadee bleep
Push:     64e1a6c origin/bleep test commit

Staged changes (1)
modified   bleep
@@ -2,3 +2,4 @@
   (while (string= "." (setq remote (magit-get-upstream-remote branch)))
     (setq branch (magit-get-upstream-branch branch)))
   remote)
+hi
\ No newline at end of file

Unmerged into yabadee (1)
64e1a6c origin/bleep test commit

Pull Requests (1)
#47  another title
     My notes:   create a new note
     Created:    Wed Jan 17 22:05:14 2018
     Updated:    Fri Jan 19 21:58:53 2018
     Author:     vermiculus
     Assignees:  none <-- place point here and type `a'
     Labels:     none
     Preview:    another body

a runs the command magithub-assignee-add (found in
magit-magithub-assignee-section-map), which is an interactive Lisp
closure in ‘magithub-user.el’.

It is bound to a.

(magithub-assignee-add ISSUE USER)

Not documented.

vermiculus avatar May 16 '18 07:05 vermiculus

This is very handy! @vermiculus I do feel that is a bit difficult to do this with spacemacs integration, since the status buffer is evilified and reach the Assignees field it's tricky. I guess to improve this some changes should be done on the spacemacs layer, I'll investigate to see if I can do something about it.

am avatar Sep 14 '18 14:09 am

Long term goal is to have a single binding for a magit-popup interface for issue/PR settings like this. Would that make it easier from a spacemacs perspective? (I don't use spacemacs so I don't know its assumptions/limitations.)

vermiculus avatar Sep 14 '18 16:09 vermiculus

I've started using spacemacs recently, so there is a lot of new things that I need to wrap my head around.

My difficulty in first place was to put the cursor in the Assignees, since the magit buffer does not accept h and l movements it's difficult to do a simple task. Instead I had to use arrow keys and >>>>>>>> until I got there. But like me others had the same problem, and the solution is already described here:

If you set evil-magit-want-horizontal-movement to t, you'll get horizontal movement using h/l in magit buffers. It moves other bindings accordingly - h to H, l to L, and L to C-l.

Then I can use a to assign reviewers and all is fine.

I guess now what could be improved would be to have this as part of the PR creation... not sure if you plan to do this.

am avatar Sep 14 '18 16:09 am

You should be able to use the magit section-movement commands; surely those exist in spacemacs, yes?

vermiculus avatar Sep 14 '18 19:09 vermiculus

I do plan to have some solution for setting up a PR completely before submission, so this issue should remain open.

vermiculus avatar Sep 14 '18 19:09 vermiculus

@vermiculus you can use magit section movement, but its evilified, by that I mean that vim keybindings are set to navigate on the buffer, so j will do magit-section-forward and k magit-section-backward.

👍 good to know this is planned. It will streamline the process of creating a PR, either way it does a lot aready. Great work BTW!

am avatar Sep 14 '18 23:09 am