Function: majutsu-squash-execute

majutsu-squash-execute is an interactive and natively compiled function defined in majutsu-squash.el.

Signature

(majutsu-squash-execute ARG1)

Documentation

Execute squash with selections recorded in the transient.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-squash.el
;;; Execution

(transient-define-suffix majutsu-squash-execute (args)
  "Execute squash with selections recorded in the transient."
  :description "Execute squash"
  :class 'majutsu-transient-default-action-suffix
  (interactive (list (majutsu-squash-arguments)))
  (pcase-let* ((`(,args ,filesets) (majutsu-filesets-split-transient-value args))
               ;; Text hunks and whole-file changes both move into the destination.
               (plan (majutsu-interactive-build-replay-plan-if-selected))
               (patch-source (and plan (majutsu-squash--patch-source-revset))))
    (when plan
      (majutsu-squash--check-patch-source args patch-source)
      (setq args (majutsu-squash--remove-interactive-tool-args args)))
    (let* ((explicit-sources (majutsu-squash--source-values args))
           (explicit-destination
            (seq-some (lambda (arg) (transient-arg-value arg args))
                      '("--into=" "--to=" "--onto=" "--destination="
                        "--insert-after=" "--after="
                        "--insert-before=" "--before=")))
           (source-default (if explicit-destination
                               '("--from=@")
                             (or (majutsu-squash--default-args) '("--from=@")))))
      (unless explicit-sources
        (setq args (append args source-default)))
      (let ((sources (majutsu-squash--source-values args)))
        (unless (or explicit-destination
                    (majutsu-squash--none-source-p sources))
          (setq args (append
                      args
                      (list (concat
                             "--into="
                             (majutsu-squash--destination-revset
                              (majutsu-squash--source-revset sources)
                              explicit-sources))))))))
    (if plan
        (progn
          ;; The selected plan rebuilds right from left, then applies forward.
          (majutsu-interactive-run-replay-plan "squash" args filesets plan)
          (majutsu-interactive-clear))
      (majutsu-run-jj-with-editor
       (cons "squash" (majutsu-jj-append-filesets args filesets))))))