Function: vc-apply-to-other-working-tree
vc-apply-to-other-working-tree is an autoloaded, interactive and
byte-compiled function defined in vc.el.gz.
Signature
(vc-apply-to-other-working-tree DIRECTORY &optional MOVE)
Documentation
Apply VC fileset's local changes to working tree under DIRECTORY.
Must be called from within an existing VC working tree. When called interactively, prompts for DIRECTORY. With a prefix argument (when called from Lisp, with optional argument MOVE non-nil), don't just copy the changes, but move them, from the current working tree to DIRECTORY.
When called from a diff-mode buffer, move or copy the changes
specified by the contents of that buffer, only.
If any changes to be moved or copied can't be applied to DIRECTORY, it is an error, and no changes are applied. If any changes to be moved can't be reverse-applied to this working tree, it is an error, and no changes are moved.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;;;###autoload
(defun vc-apply-to-other-working-tree (directory &optional move)
"Apply VC fileset's local changes to working tree under DIRECTORY.
Must be called from within an existing VC working tree.
When called interactively, prompts for DIRECTORY.
With a prefix argument (when called from Lisp, with optional argument
MOVE non-nil), don't just copy the changes, but move them, from the
current working tree to DIRECTORY.
When called from a `diff-mode' buffer, move or copy the changes
specified by the contents of that buffer, only.
If any changes to be moved or copied can't be applied to DIRECTORY, it
is an error, and no changes are applied.
If any changes to be moved can't be reverse-applied to this working
tree, it is an error, and no changes are moved."
;; The double prefix arg that `vc-apply-root-to-other-working-tree'
;; has is omitted here, for now, because it is probably less useful.
(interactive
(list
(vc--prompt-other-working-tree
(vc-responsible-backend default-directory)
(format "%s changes to working tree"
(if current-prefix-arg "Move" "Apply")))
current-prefix-arg))
(let* ((relative-dir (file-relative-name default-directory
(vc-root-dir)))
(mirror-dir (expand-file-name relative-dir directory)))
(unless (file-directory-p mirror-dir)
(user-error "`%s' not found in `%s'" relative-dir directory))
(vc--apply-to-other-working-tree directory mirror-dir
(vc-deduce-fileset)
(and (derived-mode-p 'diff-mode)
(buffer-string))
move)))