unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71461: 30.0.50; Want VC command to view a single revision like a patch
@ 2024-06-10  8:00 Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-10 21:06 ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-10  8:00 UTC (permalink / raw)
  To: 71461; +Cc: juri, dmitry

X-debbugs-cc: juri@linkov.net, dmitry@gutov.dev

Hello,

I do security work which involves backporting specific upstream commits
to older versions of the software.  I often end up with a list of
revision hashes and I use 'git cherry-pick -x' to grab them.

While resolving conflicts, I often just want to look at a summary of a
single revision.  I want to see the revision's root diff, and sometimes
also its log message.

This isn't very easy with VC at present.  There is
    C-x v b L <revision> RET =
and
    C-u C-x v D <revision>~1 RET <revision> RET
but neither are very nice (and the latter requires you to specify the
previous revision using VCS-specific notation).

Could we add a backend-generic command for this?
And might we bind it under 'C-x v' ?

I came up with the following as a start; it's not great.

--8<---------------cut here---------------start------------->8---
(defun vc-root-revision (rev)
  (interactive (list (vc-read-revision "Revision to show: ")))
  (let ((patch (vc-call-backend (vc-responsible-backend default-directory)
				'prepare-patch rev))
	(buf (get-buffer-create "*vc-revision*")))
    (set-buffer buf)
    (let ((inhibit-read-only t))
      (erase-buffer)
      (insert-buffer-substring (plist-get patch :buffer)
			       (plist-get patch :body-start)
			       (plist-get patch :body-end)))
    (setq buffer-read-only t)
    (diff-mode)
    (pop-to-buffer buf)
    (goto-char (point-min))))
--8<---------------cut here---------------end--------------->8---

-- 
Sean Whitton





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

* bug#71461: 30.0.50; Want VC command to view a single revision like a patch
  2024-06-10  8:00 bug#71461: 30.0.50; Want VC command to view a single revision like a patch Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-10 21:06 ` Dmitry Gutov
       [not found]   ` <87plsoysxk.fsf@melete.silentflame.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2024-06-10 21:06 UTC (permalink / raw)
  To: Sean Whitton, 71461; +Cc: juri

Hi!

On 10/06/2024 11:00, Sean Whitton wrote:
> While resolving conflicts, I often just want to look at a summary of a
> single revision.  I want to see the revision's root diff, and sometimes
> also its log message.
> 
> This isn't very easy with VC at present.  There is
>      C-x v b L <revision> RET =
> and
>      C-u C-x v D <revision>~1 RET <revision> RET
> but neither are very nice (and the latter requires you to specify the
> previous revision using VCS-specific notation).

There is this somewhat clunky sequence: M-1 C-x v L <revision> RET

Does this work for you?

There is description for this subfeature in vc-print-root-log's docstring.





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

* bug#71461: 30.0.50; Want VC command to view a single revision like a patch
       [not found]   ` <87plsoysxk.fsf@melete.silentflame.com>
@ 2024-06-11 11:40     ` Dmitry Gutov
  2024-06-14  1:05       ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2024-06-11 11:40 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 71461, juri

On 11/06/2024 08:00, Sean Whitton wrote:
> Oh, great, thanks.  How about this docs change for discoverability?

LGTM!





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

* bug#71461: 30.0.50; Want VC command to view a single revision like a patch
  2024-06-11 11:40     ` Dmitry Gutov
@ 2024-06-14  1:05       ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 4+ messages in thread
From: Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-14  1:05 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 71461-done, juri

Hello,

On Tue 11 Jun 2024 at 02:40pm +03, Dmitry Gutov wrote:

> On 11/06/2024 08:00, Sean Whitton wrote:
>> Oh, great, thanks.  How about this docs change for discoverability?
>
> LGTM!

Pushed that, thanks.

-- 
Sean Whitton





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

end of thread, other threads:[~2024-06-14  1:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10  8:00 bug#71461: 30.0.50; Want VC command to view a single revision like a patch Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-10 21:06 ` Dmitry Gutov
     [not found]   ` <87plsoysxk.fsf@melete.silentflame.com>
2024-06-11 11:40     ` Dmitry Gutov
2024-06-14  1:05       ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).