bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#13547: svn annotate - incorrect previous/next revision


From: Lars Ljung
Subject: bug#13547: svn annotate - incorrect previous/next revision
Date: Sun, 27 Jan 2013 12:32:47 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

2013-01-27 03:24, Glenn Morris skrev:
> 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 suppose the output from an unlimited "svn log" could be saved to speed
up future operations. vc-annotate-warp-revision might actually call
these functions multiple times.

vc-rollback is not supported by the svn backend.

I don'f fully understand how vc-diff works, but these functions are not
called for "C-x v =". This is good since that operation should not
require server access at all.

vc-annotate-show-diff-revision-at-line calls vc-svn-previous-revision.
In that case the server will be contacted twice for no good reason, a
simple "svn diff -r rev" would suffice (isn't this true for all backends?).

vc-annotate-show-changeset-diff-revision-at-line calls
vc-svn-previous-revision with filename set to nil. It that case it makes
sense to return rev-1. The modified patch below takes care of that.

=== modified file 'lisp/vc/vc-svn.el'
*** lisp/vc/vc-svn.el   2013-01-02 16:13:04 +0000
--- lisp/vc/vc-svn.el   2013-01-27 11:04:07 +0000
***************
*** 259,279 ****
  ;; 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-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))))


  ;;;
--- 259,286 ----
  ;; works just fine.

  (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)
!   (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))))


  ;;;







reply via email to

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