Function: vc--maybe-read-outgoing-base

vc--maybe-read-outgoing-base is a byte-compiled function defined in vc.el.gz.

Signature

(vc--maybe-read-outgoing-base &optional BACKEND NO-DOUBLE)

Documentation

Return upstream location for interactive uses of outgoing base commands.

If there is no prefix argument, return nil. If the current prefix argument is \C-u C-u and NO-DOUBLE is nil, return t. Otherwise prompt for an upstream location. BACKEND is the VC backend.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc--maybe-read-outgoing-base (&optional backend no-double)
  "Return upstream location for interactive uses of outgoing base commands.
If there is no prefix argument, return nil.
If the current prefix argument is \\`C-u C-u' and NO-DOUBLE is nil,
return t.
Otherwise prompt for an upstream location.
BACKEND is the VC backend."
  (cond
   ((and (not no-double) (equal current-prefix-arg '(16))) t)
   (current-prefix-arg
    (let* ((outgoing-base (vc-call-backend (or backend
                                               (vc-deduce-backend))
                                           'topic-outgoing-base))
           ;; If OUTGOING-BASE is non-nil then 'C-u C-x v T ... RET' is
           ;; how the user can force Emacs to treat the current branch
           ;; as a topic while having Emacs automatically determine the
           ;; outgoing base with which to do so (otherwise, forcing
           ;; Emacs to treat the current branch as a topic if it thinks
           ;; it's a trunk requires specifying an outgoing base which
           ;; will have that effect).
           ;;
           ;; In this case that OUTGOING-BASE is non-nil, it isn't
           ;; possible to specify an empty string as the outgoing base,
           ;; which normally means that Emacs should treat the current
           ;; branch as a trunk.  That's okay because you can use a
           ;; double prefix argument to achieve that.
           (res (read-string (if outgoing-base
                                 (format-prompt "Upstream location/branch"
                                                outgoing-base)
                               "Upstream location/branch (empty to treat as trunk): ")
                             nil 'vc-remote-location-history outgoing-base)))
      (and (not (string-empty-p res)) res)))))