Function: vc-pull

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

Signature

(vc-pull &optional ARG)

Documentation

Update the current fileset or branch.

You must be visiting a version controlled file, or in a vc-dir buffer. On a distributed version control system, this runs a "pull" operation to update the current branch, prompting for an argument list if required. Optional prefix ARG forces a prompt for the VCS command to run.

On a non-distributed version control system, update the current fileset to the tip revisions. For each unchanged and unlocked file, this simply replaces the work file with the latest revision on its branch. If the file contains changes, any changes in the tip revision are merged into the working file.

View in manual

Probably introduced at or before Emacs version 24.1.

Key Bindings

Aliases

vc-update

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;;;###autoload
(defun vc-pull (&optional arg)
  "Update the current fileset or branch.
You must be visiting a version controlled file, or in a `vc-dir' buffer.
On a distributed version control system, this runs a \"pull\"
operation to update the current branch, prompting for an argument
list if required.  Optional prefix ARG forces a prompt for the VCS
command to run.

On a non-distributed version control system, update the current
fileset to the tip revisions.  For each unchanged and unlocked
file, this simply replaces the work file with the latest revision
on its branch.  If the file contains changes, any changes in the
tip revision are merged into the working file."
  (interactive "P")
  (let* ((vc-fileset (vc-deduce-fileset t))
	 (backend (car vc-fileset))
	 (files (cadr vc-fileset)))
    (cond
     ;; If a pull operation is defined, use it.
     ((vc-find-backend-function backend 'pull)
      (vc-call-backend backend 'pull arg)
      ;; FIXME: Ideally we would only clear out the stored value for the
      ;; REMOTE-LOCATION from which we are pulling.
      (vc-run-delayed
        (vc--repo-setprop backend 'vc-incoming-revision nil)))
     ;; If VCS has `merge-news' functionality (CVS and SVN), use it.
     ((vc-find-backend-function backend 'merge-news)
      (save-some-buffers                ; save buffers visiting files
       nil (lambda ()
	     (and (buffer-modified-p)
		  (let ((file (buffer-file-name)))
		    (and file (member file files))))))
      (dolist (file files)
	(if (vc-up-to-date-p file)
	    (vc-checkout file t)
	  (vc-maybe-resolve-conflicts
	   file (vc-call-backend backend 'merge-news file)))))
     ;; For a locking VCS, check out each file.
     ((eq (vc-checkout-model backend files) 'locking)
      (dolist (file files)
	(if (vc-up-to-date-p file)
	    (vc-checkout file t))))
     (t
      (error "VC update is unsupported for `%s'" backend)))))