comparison lisp/vc-svn.el @ 98519:4031fe2e11ee

(vc-svn-after-dir-status): Handle `svn status -u' output. (vc-svn-dir-status): Respect vc-stay-local-p. (Bug#1046)
author Glenn Morris <rgm@gnu.org>
date Sat, 04 Oct 2008 20:23:54 +0000
parents e8a025cdac4a
children 2cae4bd13e67
comparison
equal deleted inserted replaced
98518:31c64334579f 98519:4031fe2e11ee
1 ;;; vc-svn.el --- non-resident support for Subversion version-control 1 ;;; vc-svn.el --- non-resident support for Subversion version-control
2 2
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
4 ;; Free Software Foundation, Inc.
4 5
5 ;; Author: FSF (see vc.el for full credits) 6 ;; Author: FSF (see vc.el for full credits)
6 ;; Maintainer: Stefan Monnier <monnier@gnu.org> 7 ;; Maintainer: Stefan Monnier <monnier@gnu.org>
7 8
8 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
144 145
145 (defun vc-svn-state-heuristic (file) 146 (defun vc-svn-state-heuristic (file)
146 "SVN-specific state heuristic." 147 "SVN-specific state heuristic."
147 (vc-svn-state file 'local)) 148 (vc-svn-state file 'local))
148 149
149 (defun vc-svn-after-dir-status (callback) 150 ;; FIXME it would be better not to have the "remote" argument,
151 ;; but to distinguish the two output formats based on content.
152 (defun vc-svn-after-dir-status (callback &optional remote)
150 (let ((state-map '((?A . added) 153 (let ((state-map '((?A . added)
151 (?C . conflict) 154 (?C . conflict)
152 (?D . removed) 155 (?D . removed)
153 (?I . ignored) 156 (?I . ignored)
154 (?M . edited) 157 (?M . edited)
155 (?R . removed) 158 (?R . removed)
156 (?? . unregistered) 159 (?? . unregistered)
157 ;; This is what vc-svn-parse-status does. 160 ;; This is what vc-svn-parse-status does.
158 (?~ . edited))) 161 (?~ . edited)))
162 (re (if remote "^\\(.\\)..... \\([ *]\\) +[-0-9]+ +\\(.*\\)$"
163 ;; Subexp 2 is a dummy in this case, so the numbers match.
164 "^\\(.\\)....\\(.\\) \\(.*\\)$"))
159 result) 165 result)
160 (goto-char (point-min)) 166 (goto-char (point-min))
161 (while (re-search-forward "^\\(.\\)..... \\(.*\\)$" nil t) 167 (while (re-search-forward re nil t)
162 (let ((state (cdr (assq (aref (match-string 1) 0) state-map))) 168 (let ((state (cdr (assq (aref (match-string 1) 0) state-map)))
163 (filename (match-string 2))) 169 (filename (match-string 3)))
170 (and remote (string-equal (match-string 2) "*")
171 ;; FIXME are there other possible combinations?
172 (cond ((eq state 'edited) (setq state 'needs-merge))
173 ((not state) (setq state 'needs-update))))
164 (when state 174 (when state
165 (setq result (cons (list filename state) result))))) 175 (setq result (cons (list filename state) result)))))
166 (funcall callback result))) 176 (funcall callback result)))
167 177
168 (defun vc-svn-dir-status (dir callback) 178 (defun vc-svn-dir-status (dir callback)
169 "Run 'svn status' for DIR and update BUFFER via CALLBACK. 179 "Run 'svn status' for DIR and update BUFFER via CALLBACK.
170 CALLBACK is called as (CALLBACK RESULT BUFFER), where 180 CALLBACK is called as (CALLBACK RESULT BUFFER), where
171 RESULT is a list of conses (FILE . STATE) for directory DIR." 181 RESULT is a list of conses (FILE . STATE) for directory DIR."
172 (vc-svn-command (current-buffer) 'async nil "status") 182 ;; FIXME should this rather be all the files in dir?
183 (let ((remote (not (vc-stay-local-p dir))))
184 (vc-svn-command (current-buffer) 'async nil "status"
185 (if remote "-u"))
173 (vc-exec-after 186 (vc-exec-after
174 `(vc-svn-after-dir-status (quote ,callback)))) 187 `(vc-svn-after-dir-status (quote ,callback) ,remote))))
175 188
176 (defun vc-svn-dir-status-files (dir files default-state callback) 189 (defun vc-svn-dir-status-files (dir files default-state callback)
177 (apply 'vc-svn-command (current-buffer) 'async nil "status" files) 190 (apply 'vc-svn-command (current-buffer) 'async nil "status" files)
178 (vc-exec-after 191 (vc-exec-after
179 `(vc-svn-after-dir-status (quote ,callback)))) 192 `(vc-svn-after-dir-status (quote ,callback))))