From: David Kågedal Date: Fri, 14 Dec 2007 08:59:49 +0000 (+0100) Subject: Emacs mode: coalesce command X-Git-Tag: v0.15-rc1~305 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/ea0def18cab66a05f0b90c4cf1d0ce17ac29fe34?hp=6df83d42732fd7fe8a55ac54714732e0dd6123d7 Emacs mode: coalesce command Signed-off-by: David Kågedal Signed-off-by: Karl Hasselström --- diff --git a/contrib/stgit.el b/contrib/stgit.el index dfbf4a0..4d0faca 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -141,6 +141,7 @@ (define-key stgit-mode-map "n" 'next-line) (define-key stgit-mode-map "g" 'stgit-refresh) (define-key stgit-mode-map "r" 'stgit-rename) (define-key stgit-mode-map "e" 'stgit-edit) + (define-key stgit-mode-map "c" 'stgit-coalesce) (define-key stgit-mode-map "N" 'stgit-new) (define-key stgit-mode-map "\C-r" 'stgit-repair) (define-key stgit-mode-map "C" 'stgit-commit) @@ -348,6 +349,26 @@ (defun stgit-create-patch-name (description) (substring patch 0 20)) (t patch)))) +(defun stgit-coalesce (patch-names) + "Run stg coalesce on the named patches" + (interactive (list (stgit-marked-patches))) + (let ((edit-buf (get-buffer-create "*stgit edit*")) + (dir default-directory)) + (log-edit 'stgit-confirm-coalesce t nil edit-buf) + (set (make-local-variable 'stgit-patches) patch-names) + (setq default-directory dir) + (let ((standard-output edit-buf)) + (apply 'stgit-run "coalesce" "--save-template=-" patch-names)))) + +(defun stgit-confirm-coalesce () + (interactive) + (let ((file (make-temp-file "stgit-edit-"))) + (write-region (point-min) (point-max) file) + (stgit-capture-output nil + (apply 'stgit-run "coalesce" "-f" file stgit-patches)) + (with-current-buffer log-edit-parent-buffer + (stgit-refresh)))) + (defun stgit-help () "Display help for the StGit mode." (interactive)