Function: majutsu-workspace-forget

majutsu-workspace-forget is an interactive and natively compiled function defined in majutsu-workspace.el.

Signature

(majutsu-workspace-forget NAMES &optional TRASH)

Documentation

Forget workspaces NAMES.

This stops tracking the workspaces' working-copy commits in the repo. With TRASH, also move the corresponding workspace directories to the system trash after jj workspace forget succeeds. TRASH accepts local workspace roots only.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-workspace.el
;;;###autoload
(defun majutsu-workspace-forget (names &optional trash)
  "Forget workspaces NAMES.

This stops tracking the workspaces' working-copy commits in the repo.
With TRASH, also move the corresponding workspace directories to the
system trash after `jj workspace forget' succeeds.  TRASH accepts local
workspace roots only."
  (interactive
   (let* ((names (majutsu-workspace--names)))
     (list (majutsu-completing-read-multiple
            "Forget workspace(s)" names nil t nil
            'majutsu-workspace-name-history nil 'majutsu-workspace)
           (majutsu-workspace--transient-trash-p))))
  (when names
    (let* ((action (if trash 'workspace-trash 'workspace-forget))
           (root-alist (when trash
                         (majutsu-workspace--roots-for-names
                          names (majutsu--toplevel-safe))))
           (trash-targets (when trash
                            (majutsu-workspace--prepare-trash-targets root-alist))))
      (unless (majutsu-confirm action
                               (format "%s workspace(s) %s? "
                                       (if trash "Forget and trash" "Forget")
                                       (if trash
                                           (mapconcat
                                            #'majutsu-workspace--trash-target-label
                                            trash-targets ", ")
                                         (string-join names ", "))))
        (user-error "Forget canceled"))
      (if (zerop (apply #'majutsu-run-jj (append '("workspace" "forget") names)))
          (progn
            (when trash
              (majutsu-workspace--signal-trash-failures
               (majutsu-workspace--trash-roots trash-targets)))
            (message (if trash
                         "Workspace(s) forgotten; available directories trashed"
                       "Workspace(s) forgotten")))
        (message "Workspace forget failed")))))