Skip to content

Commit 51168b7

Browse files
authored
Merge pull request #17 from tohojo/more-commands
2 parents ef2aa77 + 3e33a12 commit 51168b7

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

magit-stgit.el

+65-1
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ one from the minibuffer, and move to the next line."
259259
("a" "Goto" magit-stgit-goto)]
260260
[("c" "Commit" magit-stgit-commit)
261261
("C" "Uncommit" magit-stgit-uncommit)
262+
("b" "Branch" magit-stgit-branch)
262263
("r" "Repair" magit-stgit-repair)
263264
("R" "Rebase" magit-stgit-rebase)]
264265
[("z" "Undo" magit-stgit-undo)
@@ -313,7 +314,8 @@ If called interactively, read NAME from the minibuffer."
313314
:man-page "stg-edit"
314315
["Arguments"
315316
("-s" "Add Signed-off-by" "--sign")
316-
("-a" "Add Acked-by" "--ack")]
317+
("-a" "Add Acked-by" "--ack")
318+
("-r" "Add Reviewed-by" "--review")]
317319
["Actions"
318320
("e" "Edit" magit-stgit--edit)])
319321

@@ -391,6 +393,7 @@ minibuffer as well."
391393
:man-page "stg-commit"
392394
["Arguments"
393395
("-a" "Commit all applied patches" "--all")
396+
("-e" "Allow empty patches to be committed" "--allow-empty")
394397
("-n" "Commit the first N patches from the bottom up" "--number="
395398
:reader (lambda (prompt _initial-input history)
396399
(number-to-string (read-number prompt nil history))))]
@@ -472,6 +475,67 @@ into the series."
472475
(magit-run-stgit "repair")
473476
(message "Repairing series...done"))
474477

478+
(transient-define-prefix magit-stgit-branch ()
479+
"Popup console for StGit branch."
480+
:man-page "stg-branch"
481+
["Arguments"
482+
("-f" "Force cleanup or deletion even if a branch has patches" "--force")]
483+
["Branch action"
484+
("c" "Create" magit-stgit-branch-create)
485+
("C" "Clone" magit-stgit-branch-clone)
486+
("m" "Rename" magit-stgit-branch-rename)
487+
("p" "Protect" magit-stgit-branch-protect)
488+
("u" "Unprotect" magit-stgit-branch-unprotect)
489+
("k" "Delete" magit-stgit-branch-delete)
490+
("K" "Cleanup" magit-stgit-branch-cleanup)])
491+
492+
;;;###autoload
493+
(defun magit-stgit-branch-create (start branch-name)
494+
"Create and switch to a new branch"
495+
(interactive (list (magit-read-starting-point "Create and checkout branch")
496+
(read-from-minibuffer "Name for new branch: ")))
497+
(magit-run-stgit "branch" "--create" branch-name start))
498+
499+
;;;###autoload
500+
(defun magit-stgit-branch-clone (target)
501+
"Clone the contents of the current branch"
502+
(interactive (list (read-from-minibuffer "New branch name: " (magit-get-current-branch))))
503+
(magit-run-stgit "branch" "--clone" target))
504+
505+
;;;###autoload
506+
(defun magit-stgit-branch-rename (old-name new-name)
507+
"Rename an existing branch"
508+
(interactive (list (magit-read-local-branch "Branch to rename")
509+
(read-from-minibuffer "New branch name: ")))
510+
(magit-run-stgit "branch" "--rename" old-name new-name))
511+
512+
;;;###autoload
513+
(defun magit-stgit-branch-protect (target)
514+
"Prevent StGit from modifying a branch"
515+
(interactive (list (magit-read-local-branch "Branch to protect")))
516+
(magit-run-stgit "branch" "--protect" target))
517+
518+
;;;###autoload
519+
(defun magit-stgit-branch-unprotect (target)
520+
"Allow StGit to modify a previously protected branch"
521+
(interactive (list (magit-read-local-branch "Branch to unprotect")))
522+
(magit-run-stgit "branch" "--unprotect" target))
523+
524+
;;;###autoload
525+
(defun magit-stgit-branch-delete (target &rest args)
526+
"Invoke `stg uncommit ARGS...'."
527+
(interactive (append (list (magit-read-local-branch "Branch to delete"))
528+
(transient-args 'magit-stgit-branch)))
529+
(magit-run-stgit "branch" "--delete" target args))
530+
531+
;;;###autoload
532+
(defun magit-stgit-branch-cleanup (target &rest args)
533+
"Invoke `stg uncommit ARGS...'."
534+
(interactive (append (list (magit-read-local-branch "Branch to clean up"))
535+
(transient-args 'magit-stgit-branch)))
536+
(magit-run-stgit "branch" "--cleanup" target args))
537+
538+
475539
(transient-define-prefix magit-stgit-rebase ()
476540
"Rebase the stack."
477541
:man-page "stg-rebase"

0 commit comments

Comments
 (0)