Subject: Re: 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 17:39:26 +0300

On 11/10/2024 04:34, Dmitry Gutov wrote:
> 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.

Or alternatively if we would prefer to err on the side of warning the 
user that the upstream has diverged, I suppose it's the Hg 
implementation that would need to change. That can result a simpler 
mental model and documentation as well. What would be Hg's corresponding 
selector for "tip of upstream branch"?