From b802c8d77fc395139973afaaa030f44f3036240b Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 6 Feb 2008 16:22:57 +0100 Subject: Add gitsum-revert, bound to R --- gitsum.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gitsum.el b/gitsum.el index 85b0995..d13d623 100644 --- a/gitsum.el +++ b/gitsum.el @@ -14,6 +14,7 @@ (easy-mmode-defmap gitsum-diff-mode-shared-map '(("c" . gitsum-commit) ("g" . gitsum-refresh) + ("R" . gitsum-revert) ("s" . gitsum-switch-to-git-status) ("q" . gitsum-kill-buffer) ("u" . gitsum-undo)) @@ -79,6 +80,17 @@ A numeric argument serves as a repeat count." (goto-char (point-min))) (log-edit 'gitsum-do-commit nil nil buffer))) +(defun gitsum-revert () + "Revert the active patches in the working directory." + (interactive) + (let ((count (count-matches "^@@" (point-min) (point-max)))) + (if (not (yes-or-no-p + (format "Are you sure you want to revert these %d hunk(s)? " + count))) + (message "Revert canceled.") + (shell-command-on-region (point-min) (point-max) "git apply --reverse") + (gitsum-refresh)))) + (defun gitsum-do-commit () "Perform the actual commit using the current buffer as log message." (interactive) -- cgit 1.4.1