Function: vc-read-revision
vc-read-revision is a byte-compiled function defined in vc.el.gz.
Signature
(vc-read-revision PROMPT &optional FILES BACKEND DEFAULT INITIAL-INPUT MULTIPLE)
Documentation
Query the user for a revision using PROMPT.
All subsequent arguments are optional. FILES may specify a file
set to restrict the revisions to. BACKEND is a VC backend as
listed in vc-handled-backends. DEFAULT and INITIAL-INPUT are
handled as defined by completing-read. If MULTIPLE is non-nil,
the user may be prompted for multiple revisions. If possible
this means that completing-read-multiple will be used.
Probably introduced at or before Emacs version 29.1.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc-read-revision (prompt &optional files backend default initial-input multiple)
"Query the user for a revision using PROMPT.
All subsequent arguments are optional. FILES may specify a file
set to restrict the revisions to. BACKEND is a VC backend as
listed in `vc-handled-backends'. DEFAULT and INITIAL-INPUT are
handled as defined by `completing-read'. If MULTIPLE is non-nil,
the user may be prompted for multiple revisions. If possible
this means that `completing-read-multiple' will be used."
(cond
((null files)
(let ((vc-fileset (vc-deduce-fileset t))) ;FIXME: why t? --Stef
(setq files (cadr vc-fileset))
(setq backend (car vc-fileset))))
((null backend) (setq backend (vc-backend (car files)))))
;; Override any `vc-filter-command-function' value, as user probably
;; doesn't want to edit the command to get the completions.
(let* ((vc-filter-command-function #'list)
(completion-table
(vc-call-backend backend 'revision-completion-table files)))
(if completion-table
(funcall
(if multiple #'completing-read-multiple #'completing-read)
prompt completion-table nil nil initial-input 'vc-revision-history default)
(let ((answer (read-string prompt initial-input nil default)))
(if multiple
(split-string answer "[ \t]*,[ \t]*")
answer)))))