all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#13547: svn annotate - incorrect previous/next revision
@ 2013-01-25  9:29 Lars Ljung
  2013-01-27  2:24 ` Glenn Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ljung @ 2013-01-25  9:29 UTC (permalink / raw)
  To: 13547

Hi,

The functions vc-svn-previous-revision and vc-svn-next-revision just add
or subtract 1 from the revision number. The is usually not correct.

This patch uses "svn log" to get the correct previous/next revision of
the file.

Kind regards,
Lars Ljung

=== 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-25 08:26:53 +0000
*************** RESULT is a list of conses (FILE . STATE
*** 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,280 ----
  ;; works just fine.

  (defun vc-svn-previous-revision (file rev)
!   (with-temp-buffer
!     (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)
! 	(setq revision-list (cons (match-string 1) revision-list)))
!       (cadr revision-list))))

  (defun vc-svn-next-revision (file rev)
!   (with-temp-buffer
!     (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)
! 	(setq revision-list (cons (match-string 1) revision-list)))
!       (cadr revision-list))))


  ;;;






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-23 19:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-25  9:29 bug#13547: svn annotate - incorrect previous/next revision Lars Ljung
2013-01-27  2:24 ` Glenn Morris
2013-01-27 11:32   ` Lars Ljung
2021-07-15  9:01     ` Lars Ingebrigtsen
2021-07-30 11:54       ` Lars Ingebrigtsen
2021-07-31  2:40         ` Dmitry Gutov
2022-03-23 19:57           ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.