feat: checkout branch from ghpr-review-mode

This commit is contained in:
Lucas Sta Maria 2025-08-26 21:29:58 +08:00
parent aa4749c648
commit c49a89705f
Signed by: lucas
GPG key ID: F07FB16A826E3B47
3 changed files with 62 additions and 0 deletions

View file

@ -35,6 +35,7 @@
(require 'magit-git)
(require 'ghpr-api)
(require 'ghpr-repo)
(require 'ghpr-utils)
(defface ghpr-review-added-line
@ -82,6 +83,7 @@
(define-key prefix-map (kbd "C-c") 'ghpr-review-comment)
(define-key prefix-map (kbd "C-a") 'ghpr-review-approve)
(define-key prefix-map (kbd "C-r") 'ghpr-review-reject-changes)
(define-key prefix-map (kbd "C-o") 'ghpr-review-checkout-branch)
(define-key map (kbd "C-c") prefix-map)
map)
"Keymap for `ghpr-review-mode'.")
@ -401,6 +403,13 @@ Collects review body and inline comments from current buffer."
(interactive)
(ghpr--submit-review "REQUEST_CHANGES"))
(defun ghpr-review-checkout-branch ()
"Check out the PR branch using Magit."
(interactive)
(unless ghpr--review-pr-metadata
(error "No PR metadata found in buffer"))
(ghpr--checkout-pr-branch ghpr--review-pr-metadata))
(provide 'ghpr-review)
;;; ghpr-review.el ends here