Function: majutsu-blob-edit--apply-diffedit

majutsu-blob-edit--apply-diffedit is a natively compiled function defined in majutsu-file.el.

Signature

(majutsu-blob-edit--apply-diffedit CONTENT)

Documentation

Apply CONTENT to the blob revision through non-interactive jj diffedit.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-file.el
(defun majutsu-blob-edit--apply-diffedit (content)
  "Apply CONTENT to the blob revision through non-interactive `jj diffedit'."
  (let* ((root majutsu-buffer-blob-root)
         (default-directory root)
         (file majutsu-buffer-blob-path)
         (rev majutsu-buffer-blob-revision)
         (temp-file (make-nearby-temp-file "majutsu-blob-edit-"))
         (editor-config (majutsu-jj--editor-command-config
                         "ui.diff-editor"
                         (concat "$right/" file)
                         (list "cp" (majutsu-convert-filename-for-jj temp-file))))
         (args (list "diffedit"
                     "--config" editor-config
                     "--from" (concat rev "-")
                     "--to" rev
                     "--"
                     (majutsu-jj-fileset-quote file)))
         exit)
    (unwind-protect
        (progn
          (with-temp-file temp-file
            (insert content))
          (setq exit (apply #'majutsu-run-jj args)))
      (ignore-errors (delete-file temp-file)))
    exit))