GNU bug report logs -
#13547
svn annotate - incorrect previous/next revision
Previous Next
Reported by: Lars Ljung <lars <at> matholka.se>
Date: Fri, 25 Jan 2013 09:30:02 UTC
Severity: normal
Tags: patch, wontfix
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #16 received at 13547 <at> debbugs.gnu.org (full text, mbox):
Lars Ljung <lars <at> matholka.se> writes:
>> Thanks. I guess the drawback here is, that will contact the svn
>> repository, which may be on a remote server, so could be slow.
>>
>> It seems this is used by vc-annotate, vc-rollback, and vc-diff.
>
> Yes, it will be slower. But as far as I know there is no other way to
> get the previous/next revision of a file.
I haven't used svn in many years, so I don't have much of an opinion
here. I've respun the patch for Emacs 28; included below.
Anybody got an opinion here?
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index c30920dd15..0cc7bda1ba 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -248,23 +248,29 @@ vc-svn-working-revision
;; vc-svn-mode-line-string doesn't exist because the default implementation
;; works just fine.
-(defun vc-svn-previous-revision (_file rev)
- (let ((newrev (1- (string-to-number rev))))
- (when (< 0 newrev)
- (number-to-string newrev))))
+(defun vc-svn-previous-revision (file rev)
+ (if file
+ (with-temp-buffer
+ (let (process-file-side-effects)
+ (vc-svn-command t 0 file "log" "-q" "--limit" "2"
+ (format "-r%s:1" rev)))
+ (let ((revision-list '()))
+ (while (re-search-backward "^r\\([0-9]+\\)" nil t)
+ (push (match-string 1) revision-list))
+ (cadr revision-list)))
+ (let ((newrev (1- (string-to-number rev))))
+ (when (< 0 newrev)
+ (number-to-string newrev)))))
(defun vc-svn-next-revision (file rev)
- (let ((newrev (1+ (string-to-number rev))))
- ;; The "working revision" is an uneasy conceptual fit under Subversion;
- ;; we use it as the upper bound until a better idea comes along. If the
- ;; workfile version W coincides with the tree's latest revision R, then
- ;; this check prevents a "no such revision: R+1" error. Otherwise, it
- ;; inhibits showing of W+1 through R, which could be considered anywhere
- ;; from gracious to impolite.
- (unless (< (string-to-number (vc-file-getprop file 'vc-working-revision))
- newrev)
- (number-to-string newrev))))
-
+ (with-temp-buffer
+ (let (process-file-side-effects)
+ (vc-svn-command t 0 file "log" "-q" "--limit" "2"
+ (format "-r%s:HEAD" rev)))
+ (let ((revision-list '()))
+ (while (re-search-backward "^r\\([0-9]+\\)" nil t)
+ (push (match-string 1) revision-list))
+ (cadr revision-list))))
;;;
;;; State-changing functions
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 3 years and 152 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.