Function: vc-pull-and-push

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

Signature

(vc-pull-and-push &optional ARG)

Documentation

First pull, and then push the current branch.

The push will only be performed if the pull operation was successful.

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 on the current branch, prompting for the precise command if required. Optional prefix ARG non-nil forces a prompt for the VCS command to run. If this is successful, a "push" operation will then be done. This is supported only in backends where the pull operation returns a process.

On a non-distributed version control system, this signals an error. It also signals an error in a Bazaar bound branch.

Probably introduced at or before Emacs version 29.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;;;###autoload
(defun vc-pull-and-push (&optional arg)
  "First pull, and then push the current branch.
The push will only be performed if the pull operation was successful.

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 on the current branch, prompting for the precise
command if required.  Optional prefix ARG non-nil forces a prompt
for the VCS command to run.  If this is successful, a \"push\"
operation will then be done.  This is supported only in backends
where the pull operation returns a process.

On a non-distributed version control system, this signals an error.
It also signals an error in a Bazaar bound branch."
  (interactive "P")
  (let* ((vc-fileset (vc-deduce-fileset t))
	 (backend (car vc-fileset)))
    (if (vc-find-backend-function backend 'pull)
        (when-let* ((proc (vc-call-backend backend 'pull arg))
                    (buf (and (processp proc) (process-buffer proc))))
          (with-current-buffer buf
            (vc-run-delayed-success 0
              (let ((vc--inhibit-async-window t))
                (vc-push arg)))))
      (user-error "VC pull is unsupported for `%s'" backend))))