emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vc-backup b9043a3da0 4/4: Have vc-backup-diff compare a


From: ELPA Syncer
Subject: [elpa] externals/vc-backup b9043a3da0 4/4: Have vc-backup-diff compare adjacent versions by default
Date: Mon, 13 Jun 2022 06:58:12 -0400 (EDT)

branch: externals/vc-backup
commit b9043a3da0dda18cec743130c1d3186bd82fe269
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Have vc-backup-diff compare adjacent versions by default
---
 vc-backup.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/vc-backup.el b/vc-backup.el
index b2196865e4..e34861a25f 100644
--- a/vc-backup.el
+++ b/vc-backup.el
@@ -339,8 +339,11 @@ The results are written into BUFFER."
   "Generate a diff for FILES between versions REV1 and REV2.
 BUFFER and ASYNC as interpreted as specified in vc.el."
   (cl-assert (= (length files) 1))
-  (setq rev1 (or rev1 vc-backup--current-tag))
   (setq rev2 (or rev2 (vc-backup--last-rev files)))
+  (setq rev1 (or rev1 (vc-backup-previous-revision
+                       (if (consp files) (car files) files)
+                       rev2)
+                 vc-backup--current-tag))
   (save-window-excursion
     (let ((dirty 0))
       (dolist (file files)
@@ -396,11 +399,15 @@ BUFFER and ASYNC as interpreted as specified in vc.el."
 (defun vc-backup-previous-revision (file rev)
   "Determine the revision before REV for FILE."
   (let* ((backups (vc-backup--list-backups file))
-         (index (cl-position rev backups :key #'car)))
+         (index (cl-position
+                 rev backups
+                 :key #'vc-backup--extract-version
+                 :test #'string=)))
     (cond ((string= rev vc-backup--current-tag) (car backups))
           ((string= rev vc-backup--previous-tag) nil)
           ((and (natnump index) (> index 0))
-           (car (nth (1- index) backups))))))
+           (vc-backup--extract-version
+            (nth (1- index) backups))))))
 
 (defun vc-backup-next-revision (file rev)
   "Determine the revision after REV for FILE."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]