Function: vc-retrieve-tag

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

Signature

(vc-retrieve-tag DIR NAME)

Documentation

For each file in or below DIR, retrieve their tagged version NAME.

NAME can name a branch, in which case this command will switch to the named branch in the directory DIR. Interactively, prompt for DIR only for VCS that works at file level; otherwise use the repository root of the current buffer. If NAME is empty, it refers to the latest revisions of the current branch. If locking is used for the files in DIR, then there must not be any locked files at or below DIR (but if NAME is empty, locked files are allowed and simply skipped). This function runs the hook vc-retrieve-tag-hook when finished.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;;;###autoload
(defun vc-retrieve-tag (dir name)
  "For each file in or below DIR, retrieve their tagged version NAME.
NAME can name a branch, in which case this command will switch to the
named branch in the directory DIR.
Interactively, prompt for DIR only for VCS that works at file level;
otherwise use the repository root of the current buffer.
If NAME is empty, it refers to the latest revisions of the current branch.
If locking is used for the files in DIR, then there must not be any
locked files at or below DIR (but if NAME is empty, locked files are
allowed and simply skipped).
This function runs the hook `vc-retrieve-tag-hook' when finished."
  (interactive
   (let* ((granularity
           (vc-call-backend (vc-responsible-backend default-directory)
                            'revision-granularity))
          (dir
           (if (eq granularity 'repository)
               ;; For VC's that do not work at file level, it's pointless
               ;; to ask for a directory, branches are created at repository level.
               ;; XXX: Either we call expand-file-name here, or use
               ;; file-in-directory-p inside vc-resynch-buffers-in-directory.
               (expand-file-name (vc-root-dir))
             (read-directory-name "Directory: " default-directory nil t))))
     (list
      dir
      (vc-read-revision "Tag name to retrieve (default latest revisions): "
                        (list dir)
                        (vc-responsible-backend dir)))))
  (let* ((backend (vc-responsible-backend dir))
         (update (when (vc-call-backend backend 'update-on-retrieve-tag)
                   (yes-or-no-p "Update any affected buffers? ")))
	 (msg (if (or (not name) (string= name ""))
		  (format "Updating %s... " (abbreviate-file-name dir))
                (format "Retrieving tag %s into %s... "
                        name (abbreviate-file-name dir)))))
    (message "%s" msg)
    (vc-call-backend backend 'retrieve-tag dir name update)
    (vc-resynch-buffer dir t t t)
    (run-hooks 'vc-retrieve-tag-hook)
    (message "%s" (concat msg "done"))))