Skip to content

Commit 28f7f1a

Browse files
committed
Convert uncommit popup
1 parent 9bfc98b commit 28f7f1a

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

magit-stgit.el

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ one from the minibuffer, and move to the next line."
260260
("s" "Sink" magit-stgit-sink)
261261
("a" "Goto" magit-stgit-goto-popup)]
262262
[("c" "Commit" magit-stgit-commit)
263-
("C" "Uncommit" magit-stgit-uncommit-popup)
263+
("C" "Uncommit" magit-stgit-uncommit)
264264
("r" "Repair" magit-stgit-repair)
265265
("R" "Rebase" magit-stgit-rebase-popup)]
266266
[("z" "Undo" magit-stgit-undo-popup)
@@ -422,17 +422,20 @@ one from the minibuffer."
422422
(or patches (error "No patches provided")))))
423423
(magit-run-stgit-and-mark-remove patches "commit" args patches)))
424424

425-
(magit-define-popup magit-stgit-uncommit-popup
426-
"Popup console for StGit uncommit."
427-
'magit-stgit-commands
428-
:options '((?n "Uncommit the specified number of commits" "--num=" read-number))
429-
:actions '((?C "Uncommit" magit-stgit-uncommit))
430-
:default-action #'magit-stgit-uncommit)
425+
(transient-define-prefix magit-stgit-uncommit ()
426+
"Uncommit a set of patches."
427+
:man-page "stg-uncommit"
428+
["Arguments"
429+
("-n" "Uncommit the first N commits from the base down" "--number="
430+
:reader (lambda (prompt _initial-input history)
431+
(number-to-string (read-number prompt nil history))))]
432+
["Actions"
433+
("C" "Uncommit" magit-stgit--uncommit)])
431434

432435
;;;###autoload
433-
(defun magit-stgit-uncommit (&rest args)
434-
"Turn regular commits into StGit patches."
435-
(interactive (-flatten (list (magit-stgit-uncommit-arguments))))
436+
(defun magit-stgit--uncommit (&rest args)
437+
"Invoke `stg uncommit ARGS...'."
438+
(interactive (transient-args 'magit-stgit-uncommit))
436439
(magit-run-stgit "uncommit" args))
437440

438441
(magit-define-popup magit-stgit-refresh-popup
@@ -681,7 +684,7 @@ the To, Cc, and Bcc fields for all patches."
681684
:help "Edit a patch"]
682685
["Commit patch" magit-stgit-commit
683686
:help "Permanently store the base patch into the stack base"]
684-
["Uncommit patch" magit-stgit-uncommit-popup
687+
["Uncommit patch" magit-stgit-uncommit
685688
:help "Turn a regular commit into an StGit patch"]
686689
["Delete patch" magit-stgit-delete-popup
687690
:help "Delete an StGit patch"]

0 commit comments

Comments
 (0)