Function: vc-apply-root-to-other-working-tree
vc-apply-root-to-other-working-tree is an autoloaded, interactive and
byte-compiled function defined in vc.el.gz.
Signature
(vc-apply-root-to-other-working-tree DIRECTORY &optional MOVE PREVIEW)
Documentation
Apply all local changes in this working tree to the 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.
With a double prefix argument (C-u (universal-argument) C-u (universal-argument); when called from Lisp, with
optional argument PREVIEW non-nil), don't actually apply changes to
DIRECTORY, but instead show all those changes in a diff-mode buffer
with default-directory set to DIRECTORY.
You can then selectively apply changes with diff-mode commands like
diff-apply-hunk and diff-apply-buffer.
If any changes to be moved or copied can't be applied to DIRECTORY, it
is an error, and (except with C-u (universal-argument) C-u (universal-argument)) 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-root-to-other-working-tree (directory &optional move preview)
"Apply all local changes in this working tree to the 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.
With a double prefix argument (\\[universal-argument] \\[universal-argument]; \
when called from Lisp, with
optional argument PREVIEW non-nil), don't actually apply changes to
DIRECTORY, but instead show all those changes in a `diff-mode' buffer
with `default-directory' set to DIRECTORY.
You can then selectively apply changes with `diff-mode' commands like
`diff-apply-hunk' and `diff-apply-buffer'.
If any changes to be moved or copied can't be applied to DIRECTORY, it
is an error, and (except with \\[universal-argument] \\[universal-argument]) \
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."
(interactive
(list
(vc--prompt-other-working-tree
(vc-responsible-backend default-directory)
(format "%s changes to working tree"
(if (equal current-prefix-arg '(4)) "Move" "Apply")))
(equal current-prefix-arg '(4))
(equal current-prefix-arg '(16))))
(cond ((and move preview)
(error "Invalid arguments to vc-apply-root-to-other-working-tree"))
(preview
;; In this mode, no need to abort if some hunks aren't
;; applicable.
(vc-root-diff nil t)
(setq default-directory directory)
(message
(substitute-command-keys
"Use \\[diff-hunk-kill] to kill hunks not to be copied \
then \\[diff-apply-buffer] to copy changes,
or use \\[diff-apply-hunk] to copy individual hunks. \
Type \\[describe-mode] for more commands")))
(t
(let ((default-directory (vc-root-dir)))
(vc--apply-to-other-working-tree directory directory
`(,(vc-deduce-backend)
(,default-directory))
nil move)))))