From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: (vc-annotate-revision-previous-to-line) rcs, cannot go back Date: Sat, 20 Apr 2013 11:42:06 +0200 Message-ID: <87ip3hwnbl.fsf@zigzag.favinet> References: <87haj2stkw.fsf@gilgamesch.quim.ucm.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1366450785 4408 80.91.229.3 (20 Apr 2013 09:39:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Apr 2013 09:39:45 +0000 (UTC) Cc: emacs-devel@gnu.org To: Uwe Brauer Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 20 11:39:49 2013 Return-path: Envelope-to: ged-emacs-devel@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 1UTUGp-0003Xs-Lm for ged-emacs-devel@m.gmane.org; Sat, 20 Apr 2013 11:39:47 +0200 Original-Received: from localhost ([::1]:58937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTUGp-0004bY-3P for ged-emacs-devel@m.gmane.org; Sat, 20 Apr 2013 05:39:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTUGk-0004bG-1R for emacs-devel@gnu.org; Sat, 20 Apr 2013 05:39:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UTUGj-0004k2-01 for emacs-devel@gnu.org; Sat, 20 Apr 2013 05:39:41 -0400 Original-Received: from smtp209.alice.it ([82.57.200.105]:51656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTUGi-0004gl-Hj for emacs-devel@gnu.org; Sat, 20 Apr 2013 05:39:40 -0400 Original-Received: from zigzag.favinet (82.54.135.208) by smtp209.alice.it (8.6.060.15) id 511CF61A09FBF588; Sat, 20 Apr 2013 11:39:38 +0200 Original-Received: from ttn by zigzag.favinet with local (Exim 4.72) (envelope-from ) id 1UTUJF-0006eJ-Im; Sat, 20 Apr 2013 11:42:17 +0200 In-Reply-To: <87haj2stkw.fsf@gilgamesch.quim.ucm.es> (Uwe Brauer's message of "Fri, 19 Apr 2013 12:28:15 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.105 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159037 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain () Uwe Brauer () Fri, 19 Apr 2013 12:28:15 +0200 1.1 1.2 1.3 1.4 2.1 2.2 [...] Anybody knows about a hack to achieve jumping from 2.1 to 1.4. Here's a quick and dirty hack: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=vc-rcs-previous-revision.el Content-Transfer-Encoding: quoted-printable (defun vc-rcs-previous-revision (file rev) "Return the revision number immediately preceding REV for FILE, or nil if there is no previous revision. This default implementation works for MAJOR.MINOR-style revision numbers as used by RCS and CVS." (let ((branch (vc-branch-part rev)) (minor-num (string-to-number (vc-rcs-minor-part rev)))) (when branch (if (> minor-num 1) ;; revision does probably not start a branch or release (concat branch "." (number-to-string (1- minor-num))) (if (vc-rcs-trunk-p rev) ;; we are at the beginning of the trunk -- (let* ((trunk-num (string-to-number branch)) (prev (1- trunk-num)) (out (shell-command-to-string (format "rlog -r%d. '%s'" prev file)))) (if (string-match "^revision \\(.+\\)$" out) ;; return the highest revision on the previous trunk (match-string 1 out) ;; don't know anything to return here nil)) ;; we are at the beginning of a branch -- ;; return revision of starting point (vc-branch-part branch)))))) --=-=-= Content-Type: text/plain Tested with: --=-=-= Content-Type: application/shell-script Content-Disposition: inline; filename=mkfoo Content-Transfer-Encoding: base64 IyEvYmluL3NoCnNldCAtZXgKY2QgL3RtcApybSAtcmYgUkNTIGZvbwpta2RpciBSQ1MKZWNobyBh ID4gZm9vCmNpIC10LSAtbCAtbW0gZm9vCmVjaG8gYiA+PiBmb28KY2kgLXQtIC1sIC1tbSBmb28K ZWNobyBjID4+IGZvbwpjaSAtdC0gLWwgLW1tIGZvbwplY2hvIGQgPj4gZm9vCmNpIC10LSAtbCAt bW0gZm9vCmVjaG8gZSA+PiBmb28KY2kgLXQtIC1sIC1tbSAtcjIuMSBmb28KZWNobyBmID4+IGZv bwpjaSAtdC0gLWwgLW1tIGZvbwplY2hvIGcgPj4gZm9vCmNpIC10LSAtdSAtbW0gZm9vCg== --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable and: C-x C-f /tmp/foo RET M-> C-x v g p p p p p p It's dirty because it calls rlog(1) directly, sidestepping the VC abstractions, and what's worse, that info was already laboriously computed in the process of preparing the annotation buffer, then discarded (the infelicity is not limited to this function). :-/ =2D-=20 Thien-Thi Nguyen GPG key: 4C807502 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAlFyYvEACgkQZwMiJEyAdQKCuQCggJjggFJocCTWL7SNxWk7xXwR 78UAoNpEEWONsKwRyTgLQxtIlCxgOdFC =geFq -----END PGP SIGNATURE----- --==-=-=--