Function: vc-cherry-pick

vc-cherry-pick is an autoloaded, interactive and byte-compiled function defined in vc.el.gz.

Signature

(vc-cherry-pick REV &optional COMMENT INITIAL-CONTENTS BACKEND)

Documentation

Copy the changes from a single revision REV to the current branch.

When called interactively, prompts for REV. Typically REV is a revision from another branch, where that branch is one that will not be merged into the branch checked out in this working tree.

Normally a log message for the new commit is generated by the backend and includes a reference to REV so that the copy can be traced. When called interactively with a prefix argument, use REV's log message unmodified, and also skip editing it.

When called from Lisp, there are three calling conventions for the COMMENT and INITIAL-CONTENTS optional arguments:
- COMMENT a string, INITIAL-CONTENTS nil means use that comment string
  without prompting the user to edit it.
- COMMENT a string, INITIAL-CONTENTS non-nil means use that comment
  string as the initial contents of the log entry buffer but stop for
  editing.
- COMMENT t means use BACKEND's default cherry-pick comment for REV
  without prompting for editing, and ignore INITIAL-CONTENTS.

Optional argument BACKEND is the VC backend to use.

View in manual

Probably introduced at or before Emacs version 31.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;; No bindings in `vc-prefix-map' for the following three items because
;; we expect users will usually use `log-view-cherry-pick' and
;; `log-view-revert-or-delete-revisions', which do have bindings.

;;;###autoload
(defun vc-cherry-pick (rev &optional comment initial-contents backend)
  "Copy the changes from a single revision REV to the current branch.
When called interactively, prompts for REV.
Typically REV is a revision from another branch, where that branch is
one that will not be merged into the branch checked out in this working
tree.

Normally a log message for the new commit is generated by the backend
and includes a reference to REV so that the copy can be traced.
When called interactively with a prefix argument, use REV's log message
unmodified, and also skip editing it.

When called from Lisp, there are three calling conventions for the
COMMENT and INITIAL-CONTENTS optional arguments:
- COMMENT a string, INITIAL-CONTENTS nil means use that comment string
  without prompting the user to edit it.
- COMMENT a string, INITIAL-CONTENTS non-nil means use that comment
  string as the initial contents of the log entry buffer but stop for
  editing.
- COMMENT t means use BACKEND's default cherry-pick comment for REV
  without prompting for editing, and ignore INITIAL-CONTENTS.

Optional argument BACKEND is the VC backend to use."
  (interactive (let ((rev (vc-read-revision "Revision to copy: "))
                     (backend (vc-responsible-backend default-directory)))
                 (list rev
                       (and current-prefix-arg
                            (vc-call-backend backend 'get-change-comment
                                             nil rev))
                       nil
                       backend)))
  (vc--pick-or-revert rev nil nil nil comment initial-contents backend))