fix(magit): add bindings for github-review
This commit is contained in:
parent
617e46152f
commit
89f4f9d88f
2 changed files with 51 additions and 1 deletions
|
@ -93,3 +93,44 @@ control in buffers."
|
||||||
(run-with-timer 5 nil #'+magit--kill-buffer buf)
|
(run-with-timer 5 nil #'+magit--kill-buffer buf)
|
||||||
(kill-process process)
|
(kill-process process)
|
||||||
(kill-buffer buf)))))))
|
(kill-buffer buf)))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +magit/start-github-review (arg)
|
||||||
|
(interactive "P")
|
||||||
|
(call-interactively
|
||||||
|
(if (or arg (not (featurep 'forge)))
|
||||||
|
#'github-review-start
|
||||||
|
#'github-review-forge-pr-at-point)))
|
||||||
|
|
||||||
|
(defvar +magit-clone-history nil
|
||||||
|
"History for `+magit/clone' prompt.")
|
||||||
|
;;;###autoload
|
||||||
|
(defun +magit/clone (url-or-repo dir)
|
||||||
|
"Like `magit-clone', but supports additional formats on top of absolute URLs:
|
||||||
|
|
||||||
|
+ USER/REPO: assumes {`+magit-default-clone-url'}/USER/REPO
|
||||||
|
+ REPO: assumes {`+magit-default-clone-url'}/{USER}/REPO, where {USER} is
|
||||||
|
ascertained from your global gitconfig."
|
||||||
|
(interactive
|
||||||
|
(progn
|
||||||
|
(require 'ghub)
|
||||||
|
(let* ((user (ghub--username (ghub--host)))
|
||||||
|
(repo (read-from-minibuffer
|
||||||
|
"Clone repository (user/repo or url): "
|
||||||
|
(if user (concat user "/"))
|
||||||
|
nil nil '+magit-clone-history))
|
||||||
|
(name (car (last (split-string repo "/" t)))))
|
||||||
|
(list repo
|
||||||
|
(read-directory-name
|
||||||
|
"Destination: "
|
||||||
|
magit-clone-default-directory
|
||||||
|
name nil name)))))
|
||||||
|
(magit-clone-regular
|
||||||
|
(cond ((string-match-p "^[^/]+$" url-or-repo)
|
||||||
|
(require 'ghub)
|
||||||
|
(format +magit-default-clone-url (ghub--username (ghub--host)) url-or-repo))
|
||||||
|
((string-match-p "^\\([^/]+\\)/\\([^/]+\\)/?$" url-or-repo)
|
||||||
|
(apply #'format +magit-default-clone-url (split-string url-or-repo "/" t)))
|
||||||
|
(url-or-repo))
|
||||||
|
dir
|
||||||
|
nil))
|
||||||
|
|
|
@ -110,7 +110,16 @@ ensure it is built when we actually use Forge."
|
||||||
(dolist (hook forge-bug-reference-hooks)
|
(dolist (hook forge-bug-reference-hooks)
|
||||||
(add-hook hook #'forge-bug-reference-setup)))))))
|
(add-hook hook #'forge-bug-reference-setup)))))))
|
||||||
|
|
||||||
(use-package! github-review)
|
|
||||||
|
(use-package! github-review
|
||||||
|
:after magit
|
||||||
|
:config
|
||||||
|
(transient-append-suffix 'magit-merge "i"
|
||||||
|
'("y" "Review pull request" +magit/start-github-review))
|
||||||
|
(after! forge
|
||||||
|
(transient-append-suffix 'forge-dispatch "c u"
|
||||||
|
'("c r" "Review pull request" +magit/start-github-review))))
|
||||||
|
|
||||||
|
|
||||||
(use-package! magit-todos
|
(use-package! magit-todos
|
||||||
:after magit
|
:after magit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue