GNU bug report logs - #13547
svn annotate - incorrect previous/next revision

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Lars Ljung <lars@HIDDEN>; dated Fri, 25 Jan 2013 09:30:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 13547 <at> debbugs.gnu.org:


Received: (at 13547) by debbugs.gnu.org; 27 Jan 2013 11:33:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 27 06:33:14 2013
Received: from localhost ([127.0.0.1]:51122 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TzQU5-0008Tb-Jm
	for submit <at> debbugs.gnu.org; Sun, 27 Jan 2013 06:33:14 -0500
Received: from mail16.surf-town.net ([212.97.132.56]:53675
	helo=mailgw21.surf-town.net)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <lars@HIDDEN>) id 1TzQU3-0008TT-AU
	for 13547 <at> debbugs.gnu.org; Sun, 27 Jan 2013 06:33:12 -0500
Received: by mailgw21.surf-town.net (Postfix, from userid 65534)
	id 22D32403F; Sun, 27 Jan 2013 12:32:51 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
	by mailgw21.surf-town.net (Postfix) with ESMTP id 0CBE84068;
	Sun, 27 Jan 2013 12:32:51 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mailgw21.surf-town.net
X-Spam-Flag: NO
X-Spam-Score: -1.44
X-Spam-Level: 
X-Spam-Status: No, score=-1.44 tagged_above=-999 required=7
	tests=[ALL_TRUSTED=-1.44] autolearn=disabled
Received: from mailgw21.surf-town.net ([127.0.0.1])
	by localhost (mailgw21.surf-town.net [127.0.0.1]) (amavisd-new,
	port 10024)
	with LMTP id qDMp5D1l+qcw; Sun, 27 Jan 2013 12:32:48 +0100 (CET)
Received: from [192.168.0.101] (c80-216-222-115.bredband.comhem.se
	[80.216.222.115])
	by mailgw21.surf-town.net (Postfix) with ESMTPSA id 972E3403F;
	Sun, 27 Jan 2013 12:32:47 +0100 (CET)
Message-ID: <5105105F.9040500@HIDDEN>
Date: Sun, 27 Jan 2013 12:32:47 +0100
From: Lars Ljung <lars@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version: 1.0
To: Glenn Morris <rgm@HIDDEN>
Subject: Re: bug#13547: svn annotate - incorrect previous/next revision
References: <51025067.7070204@HIDDEN> <vgy5ff748s.fsf@HIDDEN>
In-Reply-To: <vgy5ff748s.fsf@HIDDEN>
X-Enigmail-Version: 1.4.6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 13547
Cc: 13547 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

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


  ;;;






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13547; Package emacs. Full text available.

Message received at 13547 <at> debbugs.gnu.org:


Received: (at 13547) by debbugs.gnu.org; 27 Jan 2013 02:24:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 26 21:24:24 2013
Received: from localhost ([127.0.0.1]:50908 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TzHuy-0002kD-GH
	for submit <at> debbugs.gnu.org; Sat, 26 Jan 2013 21:24:24 -0500
Received: from fencepost.gnu.org ([208.118.235.10]:54460)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1TzHuw-0002k5-BW
	for 13547 <at> debbugs.gnu.org; Sat, 26 Jan 2013 21:24:22 -0500
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1TzHue-0001N6-4h; Sat, 26 Jan 2013 21:24:04 -0500
From: Glenn Morris <rgm@HIDDEN>
To: Lars Ljung <lars@HIDDEN>
Subject: Re: bug#13547: svn annotate - incorrect previous/next revision
References: <51025067.7070204@HIDDEN>
X-Spook: anarchy John Kerry subversive CID Plame import Ron Brown
X-Ran: jrH"QS_g)DK;Sf\H^/?i{a|f'x"5#y|(^cGnj!znrS{Jc_g=}DNid"RaY<|V,A|:_AqGt8
X-Hue: green
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Sat, 26 Jan 2013 21:24:03 -0500
In-Reply-To: <51025067.7070204@HIDDEN> (Lars Ljung's message of "Fri, 25
	Jan 2013 10:29:11 +0100")
Message-ID: <vgy5ff748s.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: 13547
Cc: 13547 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.0 (-----)

Lars Ljung wrote:

> 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.

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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13547; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Jan 2013 09:29:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 25 04:29:50 2013
Received: from localhost ([127.0.0.1]:48642 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Tyfba-0001XD-6m
	for submit <at> debbugs.gnu.org; Fri, 25 Jan 2013 04:29:50 -0500
Received: from eggs.gnu.org ([208.118.235.92]:47796)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <lars@HIDDEN>) id 1TyfbX-0001X6-8b
	for submit <at> debbugs.gnu.org; Fri, 25 Jan 2013 04:29:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <lars@HIDDEN>) id 1TyfbI-0002s5-JJ
	for submit <at> debbugs.gnu.org; Fri, 25 Jan 2013 04:29:39 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
	autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:36829)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <lars@HIDDEN>) id 1TyfbI-0002s1-Gl
	for submit <at> debbugs.gnu.org; Fri, 25 Jan 2013 04:29:32 -0500
Received: from eggs.gnu.org ([208.118.235.92]:59104)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <lars@HIDDEN>) id 1TyfbB-0000Zc-E9
	for bug-gnu-emacs@HIDDEN; Fri, 25 Jan 2013 04:29:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <lars@HIDDEN>) id 1Tyfb5-0002pn-42
	for bug-gnu-emacs@HIDDEN; Fri, 25 Jan 2013 04:29:25 -0500
Received: from mail2.surf-town.net ([212.97.132.42]:54595
	helo=mailgw14.surf-town.net) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <lars@HIDDEN>) id 1Tyfb4-0002pW-Sj
	for bug-gnu-emacs@HIDDEN; Fri, 25 Jan 2013 04:29:19 -0500
Received: by mailgw14.surf-town.net (Postfix, from userid 65534)
	id CA7EE3E314; Fri, 25 Jan 2013 10:29:16 +0100 (CET)
Received: from localhost (localhost [127.0.0.1])
	by mailgw14.surf-town.net (Postfix) with ESMTP id B3EB33E0BA
	for <bug-gnu-emacs@HIDDEN>; Fri, 25 Jan 2013 10:29:16 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mailgw14.surf-town.net
Received: from mailgw14.surf-town.net ([127.0.0.1])
	by localhost (mailgw14.surf-town.net [127.0.0.1]) (amavisd-new,
	port 10024) with LMTP id Jl6SwPZHHaQO for <bug-gnu-emacs@HIDDEN>;
	Fri, 25 Jan 2013 10:29:13 +0100 (CET)
Received: from [192.168.0.101] (c80-216-222-115.bredband.comhem.se
	[80.216.222.115])
	by mailgw14.surf-town.net (Postfix) with ESMTPSA id CE2033E324
	for <bug-gnu-emacs@HIDDEN>; Fri, 25 Jan 2013 10:29:12 +0100 (CET)
Message-ID: <51025067.7070204@HIDDEN>
Date: Fri, 25 Jan 2013 10:29:11 +0100
From: Lars Ljung <lars@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version: 1.0
To: bug-gnu-emacs@HIDDEN
Subject: svn annotate - incorrect previous/next revision
X-Enigmail-Version: 1.4.6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.3 (----)

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


  ;;;





Acknowledgement sent to Lars Ljung <lars@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#13547; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.