diff options
author | Griffin Smith <grfn@gws.fyi> | 2020-09-09T15·59-0400 |
---|---|---|
committer | glittershark <grfn@gws.fyi> | 2020-09-09T16·09+0000 |
commit | 0d1f6d059258ce01a46830c30de0b5c965995368 (patch) | |
tree | afa0fe001b4a25f5b255e8a50d176c3837dd3b45 /users/glittershark/emacs.d/config.el | |
parent | 1c9843707914aecf3bfe4f51c47504b8d56791a4 (diff) |
feat(gs/emacs): Add command to rename branch after Clubhouse ticket r/1781
Similar to the b C command to create a *new* branch named after a clubhouse ticket, add a new b M command to *rename* a branch after the currently clocked-in clubhouse ticket. Change-Id: I750106f5d417517fd8114536d9dc0905380d616a Reviewed-on: https://cl.tvl.fyi/c/depot/+/1970 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'users/glittershark/emacs.d/config.el')
-rw-r--r-- | users/glittershark/emacs.d/config.el | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/users/glittershark/emacs.d/config.el b/users/glittershark/emacs.d/config.el index aaca78e4c768..f584e8c898ce 100644 --- a/users/glittershark/emacs.d/config.el +++ b/users/glittershark/emacs.d/config.el @@ -235,6 +235,7 @@ ;; (load! "+bindings") (load! "+commands") +(load! "cpp") (load! "+private") @@ -592,31 +593,47 @@ ["f"] (list "o" "Reset HEAD@{1}" #'magit-reset-head-previous)) + (defun magit-read-org-clubhouse-branch-name () + (when-let ((story-id (org-clubhouse-clocked-in-story-id))) + (let ((desc + (magit-read-string-ns + (format "Story description (to go after gs/ch%d/)" + story-id)))) + (format "gs/ch%d/%s" story-id desc)))) + (defun magit-read-org-clubhouse-branch-args () - (if-let ((story-id (org-clubhouse-clocked-in-story-id))) + (if (org-clubhouse-clocked-in-story-id) (let ((start-point (magit-read-starting-point "Create and checkout branch for Clubhouse story" nil "origin/master"))) (if (magit-rev-verify start-point) - (let ((desc (magit-read-string-ns - (format "Story description (to go after gs/ch%d/)" - story-id)))) + (when-let ((desc (magit-read-org-clubhouse-branch-name))) (list (format "gs/ch%d/%s" story-id desc) start-point)) (user-error "Not a valid starting point: %s" choice))) (user-error "No currently clocked-in clubhouse story"))) - (define-suffix-command magit-checkout-org-clubhouse-branch (branch start-point) + (transient-define-suffix magit-checkout-org-clubhouse-branch (branch start-point) (interactive (magit-read-org-clubhouse-branch-args)) (magit-branch-and-checkout branch start-point)) + (transient-define-suffix magit-rename-org-clubhouse-branch (old new) + (interactive + (let ((branch (magit-read-local-branch "Rename branch"))) + (list branch (magit-read-org-clubhouse-branch-name)))) + (when (and old new) + (magit-branch-rename old new))) + (transient-append-suffix #'magit-branch ["c"] (list "C" "Checkout Clubhouse branch" #'magit-checkout-org-clubhouse-branch)) - ) + (transient-append-suffix + #'magit-branch + ["c"] + (list "M" "Rename branch to Clubhouse ticket" #'magit-rename-org-clubhouse-branch))) ;; (defun grfn/split-window-more-sensibly (&optional window) ;; (let ((window (or window (selected-window)))) |