+(defun stgit-applied-at-point ()
+ "Is the patch on the current line applied?"
+ (save-excursion
+ (beginning-of-line)
+ (looking-at "[>+]")))
+
+(defun stgit-push-or-pop ()
+ "Push or pop the patch on the current line"
+ (interactive)
+ (let ((patch (stgit-patch-at-point))
+ (applied (stgit-applied-at-point)))
+ (stgit-capture-output nil
+ (stgit-run (if applied "pop" "push") patch))
+ (stgit-refresh)))
+