Function: majutsu-workspace-rename

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

Signature

(majutsu-workspace-rename WORKSPACE NEW-NAME)

Documentation

Rename WORKSPACE to NEW-NAME.

Note that Jujutsu renames the workspace associated with the current working directory, so this command may prompt for the workspace root directory.

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-rename (workspace new-name)
  "Rename WORKSPACE to NEW-NAME.

Note that Jujutsu renames the workspace associated with the current
working directory, so this command may prompt for the workspace root
directory."
  (interactive
   (let* ((root (majutsu--toplevel-safe))
          (workspace (majutsu-workspace--read-name "Rename workspace: " root))
          (new-name (and workspace
                         (majutsu-completing-read
                          (format "Rename workspace (%s) to" workspace)
                          (majutsu-workspace--names root)
                          nil nil nil 'majutsu-workspace-name-history
                          workspace 'majutsu-workspace))))
     (list workspace new-name)))
  (when (and workspace (not (string-empty-p workspace))
             new-name (not (string-empty-p new-name)))
    (let* ((root (majutsu--toplevel-safe))
           (dir (majutsu-workspace--read-root workspace root))
           (default-directory dir))
      (if (zerop (majutsu-run-jj "workspace" "rename" new-name))
          (progn
            (message "Workspace renamed"))
        (message "Workspace rename failed")))))