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 23:28:56 +0300

On 11/10/2024 18:10, Spencer Baugh wrote:

>     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"?
> 
> 
> I'm not sure, I don't think there's no way to specify that with an hg 
> revset.  Though like most hg users, I don't actually use branches, I use 
> bookmarks; there's a way to do it with bookmarks, I think. I'll investigate.

Thanks. Or if it doesn't make sense for Hg (for example, if the remote 
tip will always be present locally too), that would also be good, then 
the current implementation is just right.

> I think it's useful to think of these two options relative to vc- 
> outgoing and vc-incoming.  Comparing $1 against $2 is equivalent to 
> getting the diff from $3:
> - working-tree merge-base = vc-outgoing
> - merge-base remote-tip = vc-incoming
> - working-tree remote-tip = vc-outgoing+vc-incoming
> 
> The first two are more useful than the third, I think, since the third 
> mixes together two sorts of diffs, making it ambiguous which is which.

Makes sense.

I think #2 might be more conveniently accessed from vc-log-incoming 
(which is the only way to view the separate commits and messages).

Anyway, it seems instead of vc-root-diff we can use vc-diff-mergebase, 
it has the same completion for revisions. With REV1=@{upstream} and 
REV2="", we'll get #1, with reverse - #2. The full key sequence:

   C-u C-x v M D @{upstream} RET C-j

Note that vc-*-mergebase is only implemented for Git. But 
vc-hg-log-incoming is defined -- that seems to indicate that 'mergebase' 
would be useful to support for it too.