From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Is this a bug in vc-svn? Date: Fri, 20 Oct 2006 03:55:37 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1161368770 24162 80.91.229.2 (20 Oct 2006 18:26:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Oct 2006 18:26:10 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 20 20:26:07 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Gaz4E-0005zv-NG for ged-emacs-devel@m.gmane.org; Fri, 20 Oct 2006 20:26:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gaz4E-00082z-1j for ged-emacs-devel@m.gmane.org; Fri, 20 Oct 2006 14:26:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GapED-0004qK-V1 for emacs-devel@gnu.org; Fri, 20 Oct 2006 03:55:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GapEB-0004hf-2B for emacs-devel@gnu.org; Fri, 20 Oct 2006 03:55:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GapEA-0004hJ-T4 for emacs-devel@gnu.org; Fri, 20 Oct 2006 03:55:38 -0400 Original-Received: from [209.226.175.74] (helo=tomts20-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GapEA-0004OQ-Uv for emacs-devel@gnu.org; Fri, 20 Oct 2006 03:55:39 -0400 Original-Received: from pastel.home ([70.55.81.188]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20061020075537.TYCB16051.tomts20-srv.bellnexxia.net@pastel.home> for ; Fri, 20 Oct 2006 03:55:37 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 2FA4D8634; Fri, 20 Oct 2006 03:55:37 -0400 (EDT) Original-To: Leo In-Reply-To: (Leo's message of "Sun\, 15 Oct 2006 15\:53\:20 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:60945 Archived-At: >>> I just moved to use svn yesterday. I have files version controlled in >>> RCS and SVN. When I open them, initially they will be using RCS as the >>> backend. I then change the backend to SVN. However the version number >>> shown in the mode line is still in RCS. Is this a bug? >> >> Sounds like it. Please provide a precise recipe. >> >> >> Stefan > In shell: > 1. `cd /tmp' > 2. `mkdir wrk; cd wrk' > 3. `mkdir RCS; touch test;ci test; co -l test' > 4. `svnadmin create /tmp/repos' > 5. `svn co file:///tmp/repos .' > 6. `svn add test' > In Emacs ("emacs -Q"): > 7. C-x C-f /tmp/wrk/test RET ;; Modeline shows: RCS-1.1 > 8. C-u C-x v b svn RET ;; Modeline shows: RCS-1.1 but > SVN-0 is expected. > 9. Add some changes to test and press `C-x v v'. After checkin > modeline displays: SVN-1 The patch below should fix it. Stefan Index: lisp/vc-svn.el =================================================================== RCS file: /sources/emacs/emacs/lisp/vc-svn.el,v retrieving revision 1.27 diff -u -r1.27 vc-svn.el --- lisp/vc-svn.el 9 Feb 2006 03:47:00 -0000 1.27 +++ lisp/vc-svn.el 20 Oct 2006 07:51:17 -0000 @@ -125,8 +125,7 @@ ;; an `error' by vc-do-command. (error nil)))) (when (eq 0 status) - (vc-svn-parse-status t) - (eq 'SVN (vc-file-getprop file 'vc-backend))))))) + (vc-svn-parse-status file)))))) (defun vc-svn-state (file &optional localp) "SVN-specific version of `vc-state'." @@ -134,8 +133,7 @@ (with-temp-buffer (cd (file-name-directory file)) (vc-svn-command t 0 file "status" (if localp "-v" "-u")) - (vc-svn-parse-status localp) - (vc-file-getprop file 'vc-state))) + (vc-svn-parse-status file))) (defun vc-svn-state-heuristic (file) "SVN-specific state heuristic." @@ -149,7 +147,7 @@ ;; enough. Otherwise it might fail with remote repositories. (with-temp-buffer (vc-svn-command t 0 nil "status" (if localp "-v" "-u")) - (vc-svn-parse-status localp)))) + (vc-svn-parse-status)))) (defun vc-svn-workfile-version (file) "SVN-specific version of `vc-workfile-version'." @@ -488,10 +486,10 @@ ;; behavior for different modules on the same server. (match-string 1)))) -(defun vc-svn-parse-status (localp) +(defun vc-svn-parse-status (&optional filename) "Parse output of \"svn status\" command in the current buffer. -Set file properties accordingly. Unless FULL is t, parse only -essential information." +Set file properties accordingly. Unless FILENAME is non-nil, parse only +information about FILENAME and return its status." (let (file status) (goto-char (point-min)) (while (re-search-forward @@ -500,7 +498,9 @@ (buffer-substring (point) (line-end-position)))) (setq status (char-after (line-beginning-position))) (unless (eq status ??) - (vc-file-setprop file 'vc-backend 'SVN) + ;; `vc-BACKEND-registered' must not set vc-backend, + ;; which is instead set in vc-registered. + (unless filename (vc-file-setprop file 'vc-backend 'SVN)) ;; Use the last-modified revision, so that searching in vc-print-log ;; output works. (vc-file-setprop file 'vc-workfile-version (match-string 3)) @@ -522,7 +522,8 @@ (if (eq (char-after (match-beginning 1)) ?*) 'needs-merge 'edited)) - (t 'edited))))))) + (t 'edited))))) + (if filename (vc-file-getprop filename 'vc-state)))) (defun vc-svn-dir-state-heuristic (dir) "Find the SVN state of all files in DIR, using only local information."