GNU bug report logs - #33650
27.0.50; Root diffs between revisions

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Thu, 6 Dec 2018 22:33:01 UTC

Severity: wishlist

Found in version 27.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Juri Linkov <juri <at> linkov.net>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#33650: closed (27.0.50; Root diffs between revisions)
Date: Mon, 10 Dec 2018 23:58:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 11 Dec 2018 01:55:15 +0200
with message-id <87zhtdj5ss.fsf <at> mail.linkov.net>
and subject line Re: bug#33650: 27.0.50; Root diffs between revisions
has caused the debbugs.gnu.org bug report #33650,
regarding 27.0.50; Root diffs between revisions
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
33650: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33650
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Root diffs between revisions
Date: Thu, 06 Dec 2018 23:54:16 +0200
[Message part 3 (text/plain, inline)]
A VC command that still doesn't allow using diff-mode automatically
thus preventing proper fontification and all other related features
is `vc-root-diff' with a prefix argument HISTORIC.  It has such comment:

      ;; FIXME: this does not work right, `vc-version-diff' ends up
      ;; calling `vc-deduce-fileset' to find the files to diff, and
      ;; that's not what we want here, we want the diff for the VC root dir.

This patch fixes this omission by implementing `vc-root-version-diff'
that is able to compare two revisions even on separate branches from
their roots:

[vc-root-version-diff.patch (text/x-diff, inline)]
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index de43544864..74979e7381 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1827,6 +1827,28 @@ vc-version-diff
   (vc-diff-internal t (vc-deduce-fileset t) rev1 rev2
 		    (called-interactively-p 'interactive)))
 
+;;;###autoload
+(defun vc-root-version-diff (_files rev1 rev2)
+  "Report diffs between revisions of the whole tree in the repository history."
+  (interactive (vc-diff-build-argument-list-internal))
+  ;; This is a mix of `vc-root-diff' and `vc-version-diff'
+  (when (and (not rev1) rev2)
+    (error "Not a valid revision range"))
+  (let ((backend (vc-deduce-backend))
+        (default-directory default-directory)
+        rootdir)
+    (if backend
+	(setq rootdir (vc-call-backend backend 'root default-directory))
+      (setq rootdir (read-directory-name "Directory for VC root-diff: "))
+      (setq backend (vc-responsible-backend rootdir))
+      (if backend
+	  (setq default-directory rootdir)
+	(error "Directory is not version controlled")))
+    (let ((default-directory rootdir))
+      (vc-diff-internal
+       t (list backend (list rootdir)) rev1 rev2
+       (called-interactively-p 'interactive)))))
+
 ;;;###autoload
 (defun vc-diff (&optional historic not-urgent)
   "Display diffs between file revisions.
@@ -1900,10 +1922,8 @@ vc-root-diff
 saving the buffer."
   (interactive (list current-prefix-arg t))
   (if historic
-      ;; FIXME: this does not work right, `vc-version-diff' ends up
-      ;; calling `vc-deduce-fileset' to find the files to diff, and
-      ;; that's not what we want here, we want the diff for the VC root dir.
-      (call-interactively 'vc-version-diff)
+      ;; We want the diff for the VC root dir.
+      (call-interactively 'vc-root-version-diff)
     (when buffer-file-name (vc-buffer-sync not-urgent))
     (let ((backend (vc-deduce-backend))
 	  (default-directory default-directory)
[Message part 5 (message/rfc822, inline)]
From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 33650-done <at> debbugs.gnu.org
Subject: Re: bug#33650: 27.0.50; Root diffs between revisions
Date: Tue, 11 Dec 2018 01:55:15 +0200
>> > Isn't the result user-visible change in behavior?
>>
>> Yes, this fix changes user-visible behavior, so perhaps it should be
>> mentioned in NEWS.
>
> I think so too.
>
>> As "fileset" is essential for `vc-version-diff',
>> "whole tree" is essential for `vc-root-version-diff':
>
> OK, thanks.

Pushed to master and closed.


This bug report was last modified 6 years and 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.