Function: vc-diff-outgoing

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

Signature

(vc-diff-outgoing &optional UPSTREAM-LOCATION FILESET)

Documentation

Report changes to VC fileset that would be pushed to UPSTREAM-LOCATION.

When unspecified UPSTREAM-LOCATION is the place C-x v P (vc-push) would push to. When called interactively with a prefix argument, prompt for UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION can be a remote branch name. When called from Lisp optional argument FILESET overrides the VC fileset.

This command is like vc-diff-outgoing-base except that it does not include uncommitted changes.

See vc-use-incoming-outgoing-prefixes regarding giving this command a global binding.

View in manual

Probably introduced at or before Emacs version 31.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;;;###autoload
(defun vc-diff-outgoing (&optional upstream-location fileset)
  "Report changes to VC fileset that would be pushed to UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-push] would push
to.  When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION.  In some version control systems UPSTREAM-LOCATION
can be a remote branch name.
When called from Lisp optional argument FILESET overrides the VC
fileset.

This command is like `vc-diff-outgoing-base' except that it does not
include uncommitted changes.

See `vc-use-incoming-outgoing-prefixes' regarding giving this command a
global binding."
  ;; For this command, for distributed VCS, we want to ignore
  ;; uncommitted changes because those are not outgoing, and the point
  ;; for those VCS is to make a comparison between locally committed
  ;; changes and remote committed changes.
  ;; (Hence why we don't call `vc-buffer-sync-fileset'.)
  (interactive (list (vc--maybe-read-upstream-location)))
  (let* ((fileset (or fileset (vc-deduce-fileset t)))
         (backend (car fileset))
         (incoming (vc--incoming-revision backend upstream-location)))
    (vc-diff-internal vc-allow-async-diff fileset
                      (vc-call-backend backend 'mergebase incoming)
                      ;; FIXME: In order to exclude uncommitted
                      ;; changes we need to pass the most recent
                      ;; revision as REV2.  Calling `working-revision'
                      ;; like this works for all the backends we have
                      ;; in core that implement `mergebase' and so can
                      ;; be used with this command (Git and Hg).
                      ;; However, it is not clearly permitted by the
                      ;; current semantics of `working-revision' to
                      ;; call it on a directory.
                      ;;
                      ;; A possible alternative would be something
                      ;; like this which effectively falls back to
                      ;; including uncommitted changes in the case of
                      ;; an older VCS or where the backend rejects our
                      ;; attempt to call `working-revision' on a
                      ;; directory:
                      ;; (and (eq (vc-call-backend backend
                      ;;                           'revision-granularity)
                      ;;          'repository)
                      ;;      (ignore-errors
                      ;;        (vc-symbolic-working-revision (caadr fileset)
                      ;;                                      backend)))
                      (vc-symbolic-working-revision (caadr fileset) backend)
                      (called-interactively-p 'interactive))))