Skip to content

Commit 7767894

Browse files
committed
Convert undo popup
1 parent 5014429 commit 7767894

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

magit-stgit.el

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ one from the minibuffer, and move to the next line."
263263
("C" "Uncommit" magit-stgit-uncommit)
264264
("r" "Repair" magit-stgit-repair)
265265
("R" "Rebase" magit-stgit-rebase)]
266-
[("z" "Undo" magit-stgit-undo-popup)
266+
[("z" "Undo" magit-stgit-undo)
267267
("Z" "Redo" magit-stgit-redo-popup)]]
268268
["Patch"
269269
[("N" "New" magit-stgit-new)
@@ -559,19 +559,21 @@ ask for confirmation before deleting."
559559
(interactive (magit-stgit-read-patches nil nil t t "Show patch"))
560560
(magit-show-commit (car (magit-stgit-lines "id" patch))))
561561

562-
(magit-define-popup magit-stgit-undo-popup
563-
"Popup console for StGit undo."
564-
'magit-stgit-commands
565-
:options '((?n "Undo the last N commands" "--number=" read-number))
566-
:switches '((?h "Discard changes in index/worktree" "--hard"))
567-
:actions '((?z "Undo" magit-stgit-undo))
568-
:default-action #'magit-stgit-undo)
562+
(transient-define-prefix magit-stgit-undo ()
563+
"Undo a previous stack operation."
564+
:man-page "stg-undo"
565+
["Arguments"
566+
("-n" "Undo the last N operations" "--number="
567+
:reader (lambda (prompt _initial-input history)
568+
(number-to-string (read-number prompt nil history))))
569+
("-h" "Discard changes in index/worktree" "--hard")]
570+
["Actions"
571+
("z" "Undo" magit-stgit--undo)])
569572

570573
;;;###autoload
571-
(defun magit-stgit-undo (&rest args)
572-
"Undo the last operation.
573-
Use ARGS to pass additional arguments."
574-
(interactive (magit-stgit-undo-arguments))
574+
(defun magit-stgit--undo (&rest args)
575+
"Invoke `stg undo ARGS...'."
576+
(interactive (transient-args 'magit-stgit-undo))
575577
(magit-run-stgit "undo" args))
576578

577579
(magit-define-popup magit-stgit-redo-popup
@@ -712,8 +714,8 @@ the To, Cc, and Bcc fields for all patches."
712714
["Rebase series" magit-stgit-rebase
713715
:help "Rebase an StGit patch series"]
714716
"---"
715-
["Undo the last operation" magit-stgit-undo-popup
716-
:help "Undo the last operation"]
717+
["Undo stack operation" magit-stgit-undo
718+
:help "Undo a previous stack operation"]
717719
["Undo the last undo operation" magit-stgit-redo-popup
718720
:help "Undo the last undo operation"]))
719721

0 commit comments

Comments
 (0)