(when (memq patchsym stgit-marked-patches)
(replace-match "*" nil nil nil 2)
(setq marked (cons patchsym marked)))))
- ((looking-at "stg series: Branch \".*\" not initialised")
+ ((or (looking-at "stg series: Branch \".*\" not initialised")
+ (looking-at "stg series: .*: branch not initialized"))
(forward-line 1)
(insert "Run M-x stgit-init to initialise")))
(forward-line 1))
(define-key stgit-mode-map "P" 'stgit-push-or-pop)
(define-key stgit-mode-map "G" 'stgit-goto)
(define-key stgit-mode-map "=" 'stgit-show)
- (define-key stgit-mode-map "D" 'stgit-delete))
+ (define-key stgit-mode-map "D" 'stgit-delete)
+ (define-key stgit-mode-map [(control ?/)] 'stgit-undo)
+ (define-key stgit-mode-map "\C-_" 'stgit-undo))
(defun stgit-mode ()
"Major mode for interacting with StGit.
(stgit-capture-output nil (stgit-run "uncommit" "-n" (number-to-string arg)))
(stgit-refresh))
-(defun stgit-push-next ()
- "Push the first unapplied patch"
- (interactive)
- (stgit-capture-output nil (stgit-run "push"))
+(defun stgit-push-next (npatches)
+ "Push the first unapplied patch.
+With numeric prefix argument, push that many patches."
+ (interactive "p")
+ (stgit-capture-output nil (stgit-run "push" "-n"
+ (number-to-string npatches)))
(stgit-refresh))
-(defun stgit-pop-next ()
- "Pop the topmost applied patch"
- (interactive)
- (stgit-capture-output nil (stgit-run "pop"))
+(defun stgit-pop-next (npatches)
+ "Pop the topmost applied patch.
+With numeric prefix argument, pop that many patches."
+ (interactive "p")
+ (stgit-capture-output nil (stgit-run "pop" "-n" (number-to-string npatches)))
(stgit-refresh))
(defun stgit-applied-at-point ()
(interactive)
(describe-function 'stgit-mode))
+(defun stgit-undo (&optional arg)
+ "Run stg undo.
+With prefix argument, run it with the --hard flag."
+ (interactive "P")
+ (stgit-capture-output nil
+ (if arg
+ (stgit-run "undo" "--hard")
+ (stgit-run "undo")))
+ (stgit-refresh))
+
(provide 'stgit)