buf))
(defmacro stgit-capture-output (name &rest body)
- "Capture StGit output and show it in a window at the end."
+ "Capture StGit output and, if there was any output, show it in a window
+at the end.
+Returns nil if there was no output."
`(let ((output-buf (get-buffer-create ,(or name "*StGit output*")))
(stgit-dir default-directory)
(inhibit-read-only t))
("r" . stgit-refresh)
("\C-c\C-r" . stgit-rename)
("e" . stgit-edit)
- ("c" . stgit-coalesce)
+ ("S" . stgit-squash)
("N" . stgit-new)
("R" . stgit-repair)
("C" . stgit-commit)
(defun stgit-add-mark (patchsym)
"Mark the patch PATCHSYM."
- (setq stgit-marked-patches (cons patchsym stgit-marked-patches)))
+ (setq stgit-marked-patches (cons patchsym stgit-marked-patches))
+ (save-excursion
+ (when (stgit-goto-patch patchsym)
+ (move-to-column 1)
+ (let ((inhibit-read-only t))
+ (insert-and-inherit ?*)
+ (delete-char 1)))))
(defun stgit-remove-mark (patchsym)
"Unmark the patch PATCHSYM."
- (setq stgit-marked-patches (delq patchsym stgit-marked-patches)))
+ (setq stgit-marked-patches (delq patchsym stgit-marked-patches))
+ (save-excursion
+ (when (stgit-goto-patch patchsym)
+ (move-to-column 1)
+ (let ((inhibit-read-only t))
+ (insert-and-inherit ? )
+ (delete-char 1)))))
(defun stgit-clear-marks ()
"Unmark all patches."
"Mark the patch under point."
(interactive)
(let ((patch (stgit-patch-at-point t)))
- (stgit-add-mark patch)
- (stgit-reload))
+ (stgit-add-mark patch))
(stgit-next-patch))
(defun stgit-unmark-up ()
"Remove mark from the patch on the previous line."
(interactive)
(stgit-previous-patch)
- (stgit-remove-mark (stgit-patch-at-point t))
- (stgit-reload))
+ (stgit-remove-mark (stgit-patch-at-point t)))
(defun stgit-unmark-down ()
"Remove mark from the patch on the current line."
(interactive)
(stgit-remove-mark (stgit-patch-at-point t))
- (stgit-reload)
(stgit-next-patch))
(defun stgit-rename (name)
(apply 'stgit-run "delete" args))
(stgit-reload)))))
-(defun stgit-coalesce (patchsyms)
- "Coalesce the patches in PATCHSYMS.
-Interactively, coalesce the marked patches."
+(defun stgit-squash (patchsyms)
+ "Squash the patches in PATCHSYMS.
+Interactively, squash the marked patches."
(interactive (list stgit-marked-patches))
(when (< (length patchsyms) 2)
- (error "Need at least two patches to coalesce"))
+ (error "Need at least two patches to squash"))
(let ((edit-buf (get-buffer-create "*StGit edit*"))
(dir default-directory))
- (log-edit 'stgit-confirm-coalesce t nil edit-buf)
+ (log-edit 'stgit-confirm-squash t nil edit-buf)
(set (make-local-variable 'stgit-patchsyms) patchsyms)
(setq default-directory dir)
(let ((standard-output edit-buf))
- (apply 'stgit-run-silent "coalesce" "--save-template=-" patchsyms))))
+ (apply 'stgit-run-silent "squash" "--save-template=-" patchsyms))))
-(defun stgit-confirm-coalesce ()
+(defun stgit-confirm-squash ()
(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-patchsyms))
+ (apply 'stgit-run "squash" "-f" file stgit-patchsyms))
(with-current-buffer log-edit-parent-buffer
(stgit-clear-marks)
;; Go to first marked patch and stay there