1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 11:00:45 -08:00

vc-annotate-warp-revision: Fix going through renames

* lisp/vc/vc-annotate.el (vc-annotate--file-name-change):
New function (bug#26345).
(vc-annotate-warp-revision): Use it here.

Co-Authored-By: Jakub Ječmínek <kuba@kubajecminek.cz>
This commit is contained in:
Dmitry Gutov 2025-08-05 04:00:25 +03:00
parent e01b9bd69a
commit 65c110b913

View file

@ -667,6 +667,11 @@ describes a revision number, so warp to that revision."
(or file
(caadr vc-buffer-overriding-fileset))
newrev))
(setq file (vc-annotate--file-name-change
(or file
(caadr vc-buffer-overriding-fileset))
newrev
vc-annotate-backend))
(setq revspec (1- revspec))))
(unless newrev
(message "Cannot increment %d revisions from revision %s"
@ -675,6 +680,12 @@ describes a revision number, so warp to that revision."
(setq newrev vc-buffer-revision)
(let ((vc-use-short-revision vc-annotate-use-short-revision))
(while (and (< revspec 0) newrev)
(setq file (vc-annotate--file-name-change
(or file
(caadr vc-buffer-overriding-fileset))
newrev
vc-annotate-backend
'backward))
(setq newrev
(vc-call-backend vc-annotate-backend 'previous-revision
(or file
@ -804,6 +815,21 @@ The annotations are relative to the current time, unless overridden by OFFSET."
(message "Annotations were for revision %s; line numbers may be incorrect"
rev)))))
(defun vc-annotate--file-name-change (file rev backend &optional backward)
"Return the name of FILE at revision REV using BACKEND.
If the file name has changed in the given revision, return the new name;
otherwise, return FILE unchanged.
If BACKWARD, return the name for FILE before REV."
(if (vc-find-backend-function backend 'file-name-changes)
(or
(if backward
(car (rassoc file
(vc-call-backend backend 'file-name-changes rev)))
(cdr (assoc file
(vc-call-backend backend 'file-name-changes rev))))
file)
file))
(provide 'vc-annotate)
;;; vc-annotate.el ends here