From d4c765743ed7b29573f4ca4b4c2b05247a7f12eb Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 8 Dec 2021 13:20:57 -0500 Subject: feat(tvl.el): Add magit-gerrit-cherry-pick Bound to `A g`, this behaves similarly to `magit-gerrit-checkout` - it prompts for a CL number, then cherry-picks the latest patchset of that CL number Change-Id: Ieef970b99d96170e8c960cc7687ead9022948f8b --- tools/emacs-pkgs/tvl/tvl.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/emacs-pkgs/tvl/tvl.el b/tools/emacs-pkgs/tvl/tvl.el index 3938628edc8e..175c0c402939 100644 --- a/tools/emacs-pkgs/tvl/tvl.el +++ b/tools/emacs-pkgs/tvl/tvl.el @@ -142,10 +142,30 @@ rubberstamp operation is dangerous and should only be used in (magit-checkout "FETCH_HEAD" (magit-branch-arguments)) (message "HEAD detached at %s" cl-refspec)) + (transient-append-suffix #'magit-branch ["l"] (list "g" "gerrit CL" #'magit-gerrit-checkout)) +(transient-define-suffix magit-gerrit-cherry-pick (remote cl-refspec) + "Prompt for a CL number and cherry-pick the latest patchset of that CL" + (interactive + (let* ((remote tvl-gerrit-remote) + (cl (magit-read-cl remote))) + (list remote cl))) + (magit-fetch-refspec remote cl-refspec (magit-fetch-arguments)) + ;; That runs async, so wait for it to finish (this is how magit does it) + (while (and magit-this-process + (eq (process-status magit-this-process) 'run)) + (sleep-for 0.005)) + (magit-cherry-copy (list "FETCH_HEAD")) + (message "HEAD detached at %s" cl-refspec)) + + +(transient-append-suffix + #'magit-cherry-pick ["m"] + (list "g" "Gerrit CL" #'magit-gerrit-cherry-pick)) + (defun tvl-depot-status () "Open the TVL monorepo in magit." (interactive) -- cgit 1.4.1