From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ljung Newsgroups: gmane.emacs.bugs Subject: bug#13547: svn annotate - incorrect previous/next revision Date: Sun, 27 Jan 2013 12:32:47 +0100 Message-ID: <5105105F.9040500@matholka.se> References: <51025067.7070204@matholka.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1359286430 23441 80.91.229.3 (27 Jan 2013 11:33:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Jan 2013 11:33:50 +0000 (UTC) Cc: 13547@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 27 12:34:09 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TzQUy-0006K1-3i for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Jan 2013 12:34:08 +0100 Original-Received: from localhost ([::1]:54650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzQUg-0006Di-7u for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Jan 2013 06:33:50 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzQUb-0006DJ-OK for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 06:33:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TzQUZ-00076a-4T for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 06:33:45 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TzQUZ-00076W-0v for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 06:33:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TzQUr-0008Ub-VK for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2013 06:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ljung Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Jan 2013 11:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13547 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13547-submit@debbugs.gnu.org id=B13547.135928639432591 (code B ref 13547); Sun, 27 Jan 2013 11:34:01 +0000 Original-Received: (at 13547) by debbugs.gnu.org; 27 Jan 2013 11:33:14 +0000 Original-Received: from localhost ([127.0.0.1]:51122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TzQU5-0008Tb-Jm for submit@debbugs.gnu.org; Sun, 27 Jan 2013 06:33:14 -0500 Original-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 ) id 1TzQU3-0008TT-AU for 13547@debbugs.gnu.org; Sun, 27 Jan 2013 06:33:12 -0500 Original-Received: by mailgw21.surf-town.net (Postfix, from userid 65534) id 22D32403F; Sun, 27 Jan 2013 12:32:51 +0100 (CET) Original-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 Original-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) Original-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) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 In-Reply-To: X-Enigmail-Version: 1.4.6 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:70374 Archived-At: 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)))) ;;;