(smerge-mode 1))))
(defun stgit-expand (&optional patches collapse)
- "Show the contents selected patches, or the patch at point.
+ "Show the contents of marked patches, or the patch at point.
See also `stgit-collapse'.
(move-to-column (stgit-goal-column)))
(defun stgit-collapse (&optional patches)
- "Hide the contents selected patches, or the patch at point.
+ "Hide the contents of marked patches, or the patch at point.
See also `stgit-expand'."
(interactive (list (stgit-patches-marked-or-at-point t)))
"-"
["Move patches" stgit-move-patches
:active stgit-marked-patches
- :help "Move selected patch(es) to point"]
+ :help "Move marked patch(es) to point"]
["Squash patches" stgit-squash
:active (> (length stgit-marked-patches) 1)
- :help "Merge selected patches into one"]
+ :help "Merge marked patches into one"]
"-"
["Refresh top patch" stgit-refresh
:active (not (and (stgit-index-empty-p) (stgit-work-tree-empty-p)))
:help "Refresh the top patch with changes in index or work tree"]
["Refresh this patch" (stgit-refresh t)
:keys "\\[universal-argument] \\[stgit-refresh]"
- :help "Refresh the patch at point with changes in index or work tree"
+ :help "Refresh marked patch with changes in index or work tree"
:active (and (not (and (stgit-index-empty-p)
(stgit-work-tree-empty-p)))
(stgit-patch-name-at-point nil t))]
\\[stgit-refresh] Refresh patch with changes in index or work tree
\\[stgit-diff] Show the patch log and diff
-\\[stgit-expand] Show changes in selected patches
-\\[stgit-collapse] Hide changes in selected patches
+\\[stgit-expand] Show changes in marked patches
+\\[stgit-collapse] Hide changes in marked patches
\\[stgit-new] Create a new, empty patch
\\[stgit-new-and-refresh] Create a new patch from index or work tree
"Return the patchsym indicating a target patch for
`stgit-move-patches'.
-This is either the patch at point, or one of :top and :bottom, if
-the point is after or before the applied patches."
-
- (let ((patchsym (stgit-patch-name-at-point nil t)))
- (cond (patchsym patchsym)
- ((save-excursion (re-search-backward "^>" nil t)) :top)
- (t :bottom))))
+This is either the first unmarked patch at or after point, or one
+of :top and :bottom if the point is after or before the applied
+patches."
+
+ (save-excursion
+ (let (result)
+ (while (not result)
+ (let ((patchsym (stgit-patch-name-at-point)))
+ (cond ((memq patchsym '(:work :index)) (setq result :top))
+ (patchsym (if (memq patchsym stgit-marked-patches)
+ (stgit-next-patch)
+ (setq result patchsym)))
+ ((re-search-backward "^>" nil t) (setq result :top))
+ (t (setq result :bottom)))))
+ result)))
(defun stgit-sort-patches (patchsyms)
"Returns the list of patches in PATCHSYMS sorted according to
(unless target-patch
(error "Point not at a patch"))
- (if (eq target-patch :top)
- (stgit-capture-output nil
- (apply 'stgit-run "float" patchsyms))
-
- ;; need to have patchsyms sorted by position in the stack
- (let ((sorted-patchsyms (stgit-sort-patches patchsyms)))
- (while sorted-patchsyms
- (setq sorted-patchsyms
- (and (stgit-capture-output nil
- (if (eq target-patch :bottom)
- (stgit-run "sink" "--" (car sorted-patchsyms))
- (stgit-run "sink" "--to" target-patch "--"
- (car sorted-patchsyms))))
- (cdr sorted-patchsyms))))))
+ ;; need to have patchsyms sorted by position in the stack
+ (let ((sorted-patchsyms (stgit-sort-patches patchsyms)))
+ (stgit-capture-output nil
+ (if (eq target-patch :top)
+ (apply 'stgit-run "float" sorted-patchsyms)
+ (apply 'stgit-run
+ "sink"
+ (append (unless (eq target-patch :bottom)
+ (list "--to" target-patch))
+ '("--")
+ sorted-patchsyms)))))
(stgit-reload))
(defun stgit-squash (patchsyms)