Subject: bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes

From: Dmitry Gutov <[email-masked]>
Date: Fri, 11 Oct 2024 04:34:32 +0300

BTW:

On 13/09/2024 23:54, Spencer Baugh wrote:
> +(defun vc-git-pushed-revision (_file &optional remote-location)
> +  "Return the ref for REMOTE-LOCATION."
> +  (if (and remote-location (not (string-empty-p remote-location)))
> +      remote-location
> +    "@{upstream}"))

The function above and the function below

+(defun vc-hg-pushed-revision (_file &optional remote-location)
> +  "Return a revspec for the last commit not outgoing to REMOTE-LOCATION."
> +  (unless remote-location
> +    (setq remote-location ""))
> +  (format "last(. and not outgoing(%s))" remote-location))

...seem to be describing different kinds of refs: I think the Hg version 
refers to the last commit from the current branch that's present in the 
remote (the merge base), whereas the Git version points to the tip of 
the remote branch.

Which will be different if the remote has some newer changes added 
(perhaps someone else has pushed to it). vc-git-log-outgoing won't 
notice the difference because it uses the ".." range, but vc-git-diff 
compares two versions directly, so e.g. anything new added to the remote 
will be shown as removed in such diff.

We probably want "merge base with remote" for Git as well (git 
merge-base @{upstream} HEAD), but it doesn't have a similar short ref 
syntax.

Could use "merge-base(@{upstream})" or "@{upstream}.." as a special 
value, maybe.