Function: vc-bzr--pushpull

vc-bzr--pushpull is a byte-compiled function defined in vc-bzr.el.gz.

Signature

(vc-bzr--pushpull COMMAND PROMPT)

Documentation

Run COMMAND (a string; either push or pull) on the current Bzr branch.

If PROMPT is non-nil, prompt for the Bzr command to run.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-bzr.el.gz
(defun vc-bzr--pushpull (command prompt)
    "Run COMMAND (a string; either push or pull) on the current Bzr branch.
If PROMPT is non-nil, prompt for the Bzr command to run."
  (let* ((vc-bzr-program vc-bzr-program)
	 (branch-conf (vc-bzr-branch-conf default-directory))
	 ;; Check whether the branch is bound.
	 (bound (assoc "bound" branch-conf))
	 (bound (and bound (equal "true" (downcase (cdr bound)))))
	 (has-loc (assoc (if (equal command "push")
			     "push_location"
			   "parent_location")
			 branch-conf))
	 args)
    (when bound
      (if (equal command "push")
	  (user-error "Cannot push a bound branch")
	(setq command "update")))
    ;; If necessary, prompt for the exact command.
    (when (or prompt (if (equal command "push")
			 (not has-loc)
		       (not (or bound has-loc))))
      (setq args (split-string
		  (read-shell-command
		   (format "Bzr %s command: " command)
		   (format "%s %s" vc-bzr-program command)
		   'vc-bzr-history)
		  " " t))
      (setq vc-bzr-program (car  args)
	    command        (cadr args)
	    args           (cddr args)))
    (require 'vc-dispatcher)
    (let ((buf (apply #'vc-bzr-async-command command args)))
      (set-process-query-on-exit-flag (get-buffer-process buf) t)
      (with-current-buffer buf
        (vc-run-delayed
          (vc-compilation-mode 'bzr)
          (setq-local compile-command
                      (concat vc-bzr-program " " command " "
                              (if args (mapconcat #'identity args " ") "")))))
      (vc-set-async-update buf)
      ;; Return the process for `vc-pull-and-push'
      (get-buffer-process buf))))