unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
@ 2023-04-18 19:12 Spencer Baugh
  2023-04-18 20:36 ` Filipp Gunbin
  0 siblings, 1 reply; 13+ messages in thread
From: Spencer Baugh @ 2023-04-18 19:12 UTC (permalink / raw)
  To: 62940


Reproduction:
1. Make some local changes and commits
2. C-x v O to see the list of local commits that will be pushed
3. But there's no quick way to get a diff combining all those changes,
which is useful if you've made multiple changes to the same function
over the course of multiple commits, or if you want to review your
changes overall before sending them out for review, or any other things
like that.

C-u C-x v = lets you specify two commits to diff, and the second commit
even defaults to the working revision, but there's no easy way to get
the "base" commit that is before all your local changes.  If you're
using git, you can try to remember your upstream branch and type that
in, but that's just a matter of memory.  For other VCSs (e.g. hg)
there's no easy way.

I'm working on adding an easy way to do this in vc, but there are
several ways to approach it and I wanted to check first.

A. (my preferred way) Support a M-1 prefix argument for C-x v =, which
will do a diff against the "base" revision, whatever that is.

B. Add a new keybinding in vc-read-revision which will insert the "base"
revision, so you can just use C-u C-x v = and then insert the base
revision at the first prompt.  Seems hard to make compatible with
non-default completion frameworks.

C. Add new equivalents to C-x v = and C-x v D which diff against the
base revision.  Seems like ugly duplication of keybindings.

D. Make some way to go from a log-view like C-x v O to a diff which
combines all those commits.  Could be nice, but seems a little
unintuitive, and also doesn't support including uncommitted changes in
the diff.

Thoughts, suggestions?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-18 19:12 bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes Spencer Baugh
@ 2023-04-18 20:36 ` Filipp Gunbin
  2023-04-18 20:43   ` Dmitry Gutov
  2023-04-18 21:59   ` Spencer Baugh
  0 siblings, 2 replies; 13+ messages in thread
From: Filipp Gunbin @ 2023-04-18 20:36 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 62940

On 18/04/2023 15:12 -0400, Spencer Baugh wrote:

> Reproduction:
> 1. Make some local changes and commits
> 2. C-x v O to see the list of local commits that will be pushed
> 3. But there's no quick way to get a diff combining all those changes,
> which is useful if you've made multiple changes to the same function
> over the course of multiple commits, or if you want to review your
> changes overall before sending them out for review, or any other things
> like that.
>
> C-u C-x v = lets you specify two commits to diff, and the second commit
> even defaults to the working revision, but there's no easy way to get
> the "base" commit that is before all your local changes.  If you're
> using git, you can try to remember your upstream branch and type that
> in, but that's just a matter of memory.  For other VCSs (e.g. hg)
> there's no easy way.
>

[...]

> Thoughts, suggestions?

Usually I just do C-x v L, select commits that interest me (via region),
and do M-x log-view-diff.

Have you tried that?  What do you miss there?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-18 20:36 ` Filipp Gunbin
@ 2023-04-18 20:43   ` Dmitry Gutov
  2023-04-19  6:49     ` Juri Linkov
  2023-04-18 21:59   ` Spencer Baugh
  1 sibling, 1 reply; 13+ messages in thread
From: Dmitry Gutov @ 2023-04-18 20:43 UTC (permalink / raw)
  To: Filipp Gunbin, Spencer Baugh; +Cc: 62940

On 18/04/2023 23:36, Filipp Gunbin wrote:
> Usually I just do C-x v L, select commits that interest me (via region),
> and do M-x log-view-diff.

Just in case: 'log-view-diff' is bound to '='.

That's what I wanted to suggest, too. Or use 'vc-log-outgoing':

   C-x v O C-x h =

Which would be D. in the original message. It doesn't support 
uncommitted changes, but I would be surprised if it did.

But one can also try this:

   C-u C-x v D origin/master ^J

Where origin/master is the name of the upstream branch ref. This should 
include uncommitted changes.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-18 20:36 ` Filipp Gunbin
  2023-04-18 20:43   ` Dmitry Gutov
@ 2023-04-18 21:59   ` Spencer Baugh
  2023-04-21 18:36     ` sbaugh
  1 sibling, 1 reply; 13+ messages in thread
From: Spencer Baugh @ 2023-04-18 21:59 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 62940

Filipp Gunbin <fgunbin@fastmail.fm> writes:
> Usually I just do C-x v L, select commits that interest me (via region),
> and do M-x log-view-diff.
>
> Have you tried that?  What do you miss there?

Wow, amazing, I did not think to try that!  After some further
improvements to my vc backend, that is perfect!





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-18 20:43   ` Dmitry Gutov
@ 2023-04-19  6:49     ` Juri Linkov
  2023-08-14 19:42       ` Spencer Baugh
  0 siblings, 1 reply; 13+ messages in thread
From: Juri Linkov @ 2023-04-19  6:49 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Spencer Baugh, 62940, Filipp Gunbin

>   C-x v O C-x h =
>
> Which would be D. in the original message. It doesn't support uncommitted
> changes, but I would be surprised if it did.

It's supported only for vc that inserts a text header in logs like RCS.
I proposed to insert extra line that represents uncommitted git changes,
and I'm using this feature all the time.  But the problem is that
it's inserted even when 'C-x v b l' lists another branch
where such line makes no sense.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-18 21:59   ` Spencer Baugh
@ 2023-04-21 18:36     ` sbaugh
  2023-04-22  6:57       ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: sbaugh @ 2023-04-21 18:36 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 62940, Filipp Gunbin

Spencer Baugh <sbaugh@janestreet.com> writes:
> Filipp Gunbin <fgunbin@fastmail.fm> writes:
>> Usually I just do C-x v L, select commits that interest me (via region),
>> and do M-x log-view-diff.
>>
>> Have you tried that?  What do you miss there?
>
> Wow, amazing, I did not think to try that!  After some further
> improvements to my vc backend, that is perfect!

After using it for a bit, one issue is that C-x v O shows changes in all
files; it would be nice if there was a way to get outgoing
changes/commits only for the current fileset.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-21 18:36     ` sbaugh
@ 2023-04-22  6:57       ` Eli Zaretskii
  2023-04-22 13:00         ` sbaugh
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2023-04-22  6:57 UTC (permalink / raw)
  To: sbaugh; +Cc: sbaugh, 62940, fgunbin

> Cc: 62940@debbugs.gnu.org, Filipp Gunbin <fgunbin@fastmail.fm>
> From: sbaugh@catern.com
> Date: Fri, 21 Apr 2023 18:36:01 +0000 (UTC)
> 
> After using it for a bit, one issue is that C-x v O shows changes in all
> files; it would be nice if there was a way to get outgoing
> changes/commits only for the current fileset.

What is the current fileset for "C-x v O"? isn't that "all files"
anyway?

I could understand if you were talking about a VC command invoked from
a vc-dir buffer or a Dired buffer, where you can mark files to be
considered as the current fileset.  That would mean your comment is
about the vc-dir command 'O' or the equivalent in Dired.  But
otherwise, I'm not sure I understand the UI you have in mind.

And then there's the issue of whether the backend supports what you
want, of course.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-22  6:57       ` Eli Zaretskii
@ 2023-04-22 13:00         ` sbaugh
  2023-04-22 13:17           ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: sbaugh @ 2023-04-22 13:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: sbaugh, 62940, fgunbin

Eli Zaretskii <eliz@gnu.org> writes:
>> Cc: 62940@debbugs.gnu.org, Filipp Gunbin <fgunbin@fastmail.fm>
>> From: sbaugh@catern.com
>> Date: Fri, 21 Apr 2023 18:36:01 +0000 (UTC)
>> 
>> After using it for a bit, one issue is that C-x v O shows changes in all
>> files; it would be nice if there was a way to get outgoing
>> changes/commits only for the current fileset.
>
> What is the current fileset for "C-x v O"? isn't that "all files"
> anyway?

Well, yes, that's the issue.  When my current fileset is not "all files"
(for example when I am in an individual file without marking files in a
vc-dir buffer) I would like to be able to see outgoing changes on just
those files.  C-x v O overrides the fileset to be "all files" instead.

> I could understand if you were talking about a VC command invoked from
> a vc-dir buffer or a Dired buffer, where you can mark files to be
> considered as the current fileset.  That would mean your comment is
> about the vc-dir command 'O' or the equivalent in Dired.  But
> otherwise, I'm not sure I understand the UI you have in mind.

1. View a file buffer
2. Hit C-x v O
3. See outgoing changes only for that file

> And then there's the issue of whether the backend supports what you
> want, of course.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-22 13:00         ` sbaugh
@ 2023-04-22 13:17           ` Eli Zaretskii
  2023-04-22 18:33             ` Dmitry Gutov
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2023-04-22 13:17 UTC (permalink / raw)
  To: sbaugh; +Cc: sbaugh, 62940, fgunbin

> From: sbaugh@catern.com
> Date: Sat, 22 Apr 2023 13:00:48 +0000 (UTC)
> Cc: sbaugh@janestreet.com, 62940@debbugs.gnu.org, fgunbin@fastmail.fm
> 
> 1. View a file buffer
> 2. Hit C-x v O
> 3. See outgoing changes only for that file

I don't think it is TRT to change the behavior of "C-x v O" in the
above scenario.  Because it will make it much harder to see the
changes for all the files, since in Emacs you are almost always "in
some file-visiting buffer".

So the above can only be optional behavior, not the default.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-22 13:17           ` Eli Zaretskii
@ 2023-04-22 18:33             ` Dmitry Gutov
  2023-04-22 19:27               ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Gutov @ 2023-04-22 18:33 UTC (permalink / raw)
  To: Eli Zaretskii, sbaugh; +Cc: sbaugh, 62940, fgunbin

On 22/04/2023 16:17, Eli Zaretskii wrote:
>> From:sbaugh@catern.com
>> Date: Sat, 22 Apr 2023 13:00:48 +0000 (UTC)
>> Cc:sbaugh@janestreet.com,62940@debbugs.gnu.org,fgunbin@fastmail.fm
>>
>> 1. View a file buffer
>> 2. Hit C-x v O
>> 3. See outgoing changes only for that file
> I don't think it is TRT to change the behavior of "C-x v O" in the
> above scenario.  Because it will make it much harder to see the
> changes for all the files, since in Emacs you are almost always "in
> some file-visiting buffer".
> 
> So the above can only be optional behavior, not the default.
> 
> 
> 

We could add a couple of new commands, with -fileset- in their names. 
Couple - for incoming and outgoing.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-22 18:33             ` Dmitry Gutov
@ 2023-04-22 19:27               ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2023-04-22 19:27 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: sbaugh, 62940, fgunbin, sbaugh

> Date: Sat, 22 Apr 2023 21:33:35 +0300
> Cc: sbaugh@janestreet.com, 62940@debbugs.gnu.org, fgunbin@fastmail.fm
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> On 22/04/2023 16:17, Eli Zaretskii wrote:
> > I don't think it is TRT to change the behavior of "C-x v O" in the
> > above scenario.  Because it will make it much harder to see the
> > changes for all the files, since in Emacs you are almost always "in
> > some file-visiting buffer".
> > 
> > So the above can only be optional behavior, not the default.
> 
> We could add a couple of new commands, with -fileset- in their names. 
> Couple - for incoming and outgoing.

That would work, of course.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-04-19  6:49     ` Juri Linkov
@ 2023-08-14 19:42       ` Spencer Baugh
  2023-08-16  7:48         ` Juri Linkov
  0 siblings, 1 reply; 13+ messages in thread
From: Spencer Baugh @ 2023-08-14 19:42 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Dmitry Gutov, 62940, Filipp Gunbin

Juri Linkov <juri@linkov.net> writes:
>>   C-x v O C-x h =
>>
>> Which would be D. in the original message. It doesn't support uncommitted
>> changes, but I would be surprised if it did.
>
> It's supported only for vc that inserts a text header in logs like RCS.
> I proposed to insert extra line that represents uncommitted git changes,
> and I'm using this feature all the time.

Is your patch for this available somewhere?  I find myself wanting the
same thing for hg.

> But the problem is that it's inserted even when 'C-x v b l' lists
> another branch where such line makes no sense.

Maybe we could only insert this line if there are actually uncommitted
changes?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
  2023-08-14 19:42       ` Spencer Baugh
@ 2023-08-16  7:48         ` Juri Linkov
  0 siblings, 0 replies; 13+ messages in thread
From: Juri Linkov @ 2023-08-16  7:48 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: Dmitry Gutov, 62940, Filipp Gunbin

>>>   C-x v O C-x h =
>>>
>>> Which would be D. in the original message. It doesn't support uncommitted
>>> changes, but I would be surprised if it did.
>>
>> It's supported only for vc that inserts a text header in logs like RCS.
>> I proposed to insert extra line that represents uncommitted git changes,
>> and I'm using this feature all the time.
>
> Is your patch for this available somewhere?  I find myself wanting the
> same thing for hg.

Searching the right version in the archives would take much time,
so it's easier just to send the version that I use every day.
Here it is, just 3 new lines:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index a7763360795..37dc619da5e 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1419,6 +1419,9 @@ vc-git-print-log
     ;; read-only.
     (let ((inhibit-read-only t))
       (with-current-buffer buffer
+        (when (memq vc-log-view-type '(long short))
+          (insert (propertize "(Type 'd' here to show diffs with working version)\n"
+                              'font-lock-face 'shadow)))
 	(apply #'vc-git-command buffer
 	       'async files
 	       (append

>> But the problem is that it's inserted even when 'C-x v b l' lists
>> another branch where such line makes no sense.
>
> Maybe we could only insert this line if there are actually uncommitted
> changes?

Good idea.  Also this line should not be shown in the output of
'vc-print-branch-log'.

PS: Sorry that answering your other requests about the project features
will take a little more time.





^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-08-16  7:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 19:12 bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes Spencer Baugh
2023-04-18 20:36 ` Filipp Gunbin
2023-04-18 20:43   ` Dmitry Gutov
2023-04-19  6:49     ` Juri Linkov
2023-08-14 19:42       ` Spencer Baugh
2023-08-16  7:48         ` Juri Linkov
2023-04-18 21:59   ` Spencer Baugh
2023-04-21 18:36     ` sbaugh
2023-04-22  6:57       ` Eli Zaretskii
2023-04-22 13:00         ` sbaugh
2023-04-22 13:17           ` Eli Zaretskii
2023-04-22 18:33             ` Dmitry Gutov
2023-04-22 19:27               ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).