Function: vc-prepare-patch-prompt-revisions

vc-prepare-patch-prompt-revisions is a byte-compiled function defined in vc.el.gz.

Signature

(vc-prepare-patch-prompt-revisions)

Documentation

Prompt the user for a list of revisions.

Prepare a default value, depending on the current context. With a numerical prefix argument, use the last N revisions as the default value. If the current buffer is a log-view buffer, use the marked commits. Otherwise fall back to the working revision of the current file.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc-prepare-patch-prompt-revisions ()
  "Prompt the user for a list of revisions.
Prepare a default value, depending on the current context.  With
a numerical prefix argument, use the last N revisions as the
default value.  If the current buffer is a log-view buffer, use
the marked commits.  Otherwise fall back to the working revision
of the current file."
  (vc-read-multiple-revisions
   "Revisions: " nil nil nil
   (or (and-let* ((arg current-prefix-arg)
                  (fs (vc-deduce-fileset t)))
         (cl-loop with file = (caadr fs)
                  repeat (prefix-numeric-value arg)
                  for rev = (vc-working-revision file)
                  then (vc-call-backend
                        (car fs) 'previous-revision
                        file rev)
                  when rev collect it into revs
                  finally return (mapconcat #'identity revs ",")))
       (and-let* ((revs (log-view-get-marked)))
         (mapconcat #'identity revs ","))
       (and-let* ((file (buffer-file-name)))
         (vc-working-revision file)))))