First cut at vc-svn.el.
[emacs.git] / lisp / vc-svn.el
blob780b71746cef34bd2cf55361055d9798a3a353f0
1 ;;; vc-svn.el --- non-resident support for Subversion version-control
3 ;; Copyright (C) 1995,98,99,2000,2001,2002 Free Software Foundation, Inc.
5 ;; Author: FSF (see vc.el for full credits)
6 ;; Maintainer: Stefan Monnier <monnier@gnu.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; Commentary:
27 ;; This is preliminary support for Subversion (http://subversion.tigris.org/).
28 ;; It started as `sed s/cvs/svn/ vc.cvs.el' (from version 1.56)
29 ;; and hasn't been completely fixed since.
31 ;; Sync'd with Subversion's vc-svn.el as of revision 5801.
33 ;;; Bugs:
35 ;; - VC-dired is either not working or (really) dog slow.
36 ;; - vc-print-log does not always jump to the proper log entry because
37 ;; it tries to jump to version 1234 even if there's only an entry
38 ;; for 1232 (because the file hasn't changed since).
40 ;;; Code:
42 (eval-when-compile
43 (require 'vc))
45 ;;;
46 ;;; Customization options
47 ;;;
49 (defcustom vc-svn-global-switches nil
50 "*Global switches to pass to any SVN command."
51 :type '(choice (const :tag "None" nil)
52 (string :tag "Argument String")
53 (repeat :tag "Argument List"
54 :value ("")
55 string))
56 :version "21.4"
57 :group 'vc)
59 (defcustom vc-svn-register-switches nil
60 "*Extra switches for registering a file into SVN.
61 A string or list of strings passed to the checkin program by
62 \\[vc-register]."
63 :type '(choice (const :tag "None" nil)
64 (string :tag "Argument String")
65 (repeat :tag "Argument List"
66 :value ("")
67 string))
68 :version "21.1"
69 :group 'vc)
71 (defcustom vc-svn-diff-switches nil
72 "*A string or list of strings specifying extra switches for svn diff under VC."
73 :type '(choice (const :tag "None" nil)
74 (string :tag "Argument String")
75 (repeat :tag "Argument List"
76 :value ("")
77 string))
78 :version "21.1"
79 :group 'vc)
81 (defcustom vc-svn-header (or (cdr (assoc 'SVN vc-header-alist)) '("\$Id\$"))
82 "*Header keywords to be inserted by `vc-insert-headers'."
83 :version "21.1"
84 :type '(repeat string)
85 :group 'vc)
87 (defcustom vc-svn-use-edit nil
88 "*Non-nil means to use `svn edit' to \"check out\" a file.
89 This is only meaningful if you don't use the implicit checkout model
90 \(i.e. if you have $SVNREAD set)."
91 :type 'boolean
92 :version "21.1"
93 :group 'vc)
95 (defcustom vc-svn-stay-local t
96 "*Non-nil means use local operations when possible for remote repositories.
97 This avoids slow queries over the network and instead uses heuristics
98 and past information to determine the current status of a file.
100 The value can also be a regular expression or list of regular
101 expressions to match against the host name of a repository; then VC
102 only stays local for hosts that match it. Alternatively, the value
103 can be a list of regular expressions where the first element is the
104 symbol `except'; then VC always stays local except for hosts matched
105 by these regular expressions."
106 :type '(choice (const :tag "Always stay local" t)
107 (const :tag "Don't stay local" nil)
108 (list :format "\nExamine hostname and %v" :tag "Examine hostname ..."
109 (set :format "%v" :inline t (const :format "%t" :tag "don't" except))
110 (regexp :format " stay local,\n%t: %v" :tag "if it matches")
111 (repeat :format "%v%i\n" :inline t (regexp :tag "or"))))
112 :version "21.1"
113 :group 'vc)
116 ;;; State-querying functions
119 ;;;###autoload (defun vc-svn-registered (f)
120 ;;;###autoload (when (file-readable-p (expand-file-name
121 ;;;###autoload ".svn/entries" (file-name-directory f)))
122 ;;;###autoload (load "vc-svn")
123 ;;;###autoload (vc-svn-registered f)))
125 (defun vc-svn-registered (file)
126 "Check if FILE is SVN registered."
127 (when (file-readable-p (expand-file-name ".svn/entries"
128 (file-name-directory file)))
129 (with-temp-buffer
130 (cd (file-name-directory file))
131 (condition-case nil
132 (vc-svn-command t 0 file "status" "-v")
133 ;; We can't find an `svn' executable. We could also deregister SVN.
134 (file-error nil)
135 (vc-svn-parse-status t)
136 (eq 'SVN (vc-file-getprop file 'vc-backend)))))
138 (defun vc-svn-state (file &optional localp)
139 "SVN-specific version of `vc-state'."
140 (setq localp (or localp (vc-svn-stay-local-p file)))
141 (with-temp-buffer
142 (cd (file-name-directory file))
143 (vc-svn-command t 0 file "status" (if localp "-v" "-u"))
144 (vc-svn-parse-status localp)
145 (vc-file-getprop file 'vc-state)))
147 (defun vc-svn-state-heuristic (file)
148 "SVN-specific state heuristic."
149 (vc-svn-state file 'local))
151 (defun vc-svn-dir-state (dir &optional localp)
152 "Find the SVN state of all files in DIR."
153 (setq localp (or localp (vc-svn-stay-local-p dir)))
154 (let ((default-directory dir))
155 ;; Don't specify DIR in this command, the default-directory is
156 ;; enough. Otherwise it might fail with remote repositories.
157 (with-temp-buffer
158 (vc-svn-command t 0 nil "status" (if localp "-v" "-u"))
159 (vc-svn-parse-status localp))))
161 (defun vc-svn-workfile-version (file)
162 "SVN-specific version of `vc-workfile-version'."
163 ;; There is no need to consult RCS headers under SVN, because we
164 ;; get the workfile version for free when we recognize that a file
165 ;; is registered in SVN.
166 (vc-svn-registered file)
167 (vc-file-getprop file 'vc-workfile-version))
169 (defun vc-svn-checkout-model (file)
170 "SVN-specific version of `vc-checkout-model'."
171 ;; It looks like Subversion has no equivalent of CVSREAD.
172 'implicit)
174 (defun vc-svn-mode-line-string (file)
175 "Return string for placement into the modeline for FILE.
176 Compared to the default implementation, this function does two things:
177 Handle the special case of a SVN file that is added but not yet
178 committed and support display of sticky tags."
179 (let* ((state (vc-state file))
180 (rev (vc-workfile-version file))
181 (sticky-tag (vc-file-getprop file 'vc-svn-sticky-tag))
182 (sticky-tag-printable (and sticky-tag
183 (not (string= sticky-tag ""))
184 (concat "[" sticky-tag "]"))))
185 (cond ((string= rev "0")
186 ;; A file that is added but not yet committed.
187 "SVN @@")
188 ((or (eq state 'up-to-date)
189 (eq state 'needs-patch))
190 (concat "SVN-" rev sticky-tag-printable))
191 ((stringp state)
192 (concat "SVN:" state ":" rev sticky-tag-printable))
194 ;; Not just for the 'edited state, but also a fallback
195 ;; for all other states. Think about different symbols
196 ;; for 'needs-patch and 'needs-merge.
197 (concat "SVN:" rev sticky-tag-printable)))))
199 (defun vc-svn-dired-state-info (file)
200 "SVN-specific version of `vc-dired-state-info'."
201 (let* ((svn-state (vc-state file))
202 (state (cond ((eq svn-state 'edited) "modified")
203 ((eq svn-state 'needs-patch) "patch")
204 ((eq svn-state 'needs-merge) "merge")
205 ;; FIXME: those two states cannot occur right now
206 ((eq svn-state 'unlocked-changes) "conflict")
207 ((eq svn-state 'locally-added) "added")
209 (if state (concat "(" state ")"))))
213 ;;; State-changing functions
216 (defun vc-svn-register (file &optional rev comment)
217 "Register FILE into the SVN version-control system.
218 COMMENT can be used to provide an initial description of FILE.
220 `vc-register-switches' and `vc-svn-register-switches' are passed to
221 the SVN command (in that order)."
222 (let ((switches (append
223 (if (stringp vc-register-switches)
224 (list vc-register-switches)
225 vc-register-switches)
226 (if (stringp vc-svn-register-switches)
227 (list vc-svn-register-switches)
228 vc-svn-register-switches))))
230 (apply 'vc-svn-command nil 0 file
231 "add"
232 ;; (and comment (string-match "[^\t\n ]" comment)
233 ;; (concat "-m" comment))
234 switches)))
236 (defun vc-svn-responsible-p (file)
237 "Return non-nil if SVN thinks it is responsible for FILE."
238 (file-directory-p (expand-file-name ".svn"
239 (if (file-directory-p file)
240 file
241 (file-name-directory file)))))
243 (defalias 'vc-svn-could-register 'vc-svn-responsible-p
244 "Return non-nil if FILE could be registered in SVN.
245 This is only possible if SVN is responsible for FILE's directory.")
247 (defun vc-svn-checkin (file rev comment)
248 "SVN-specific version of `vc-backend-checkin'."
249 (let ((switches (if (stringp vc-checkin-switches)
250 (list vc-checkin-switches)
251 vc-checkin-switches))
252 status)
253 (setq status (apply 'vc-svn-command nil 1 file
254 "ci" (list* "-m" comment switches)))
255 (set-buffer "*vc*")
256 (goto-char (point-min))
257 (unless (equal status 0)
258 ;; Check checkin problem.
259 (cond
260 ((re-search-forward "Up-to-date check failed" nil t)
261 (vc-file-setprop file 'vc-state 'needs-merge)
262 (error (substitute-command-keys
263 (concat "Up-to-date check failed: "
264 "type \\[vc-next-action] to merge in changes"))))
266 (pop-to-buffer (current-buffer))
267 (goto-char (point-min))
268 (shrink-window-if-larger-than-buffer)
269 (error "Check-in failed"))))
270 ;; Update file properties
271 ;; (vc-file-setprop
272 ;; file 'vc-workfile-version
273 ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
276 (defun vc-svn-find-version (file rev buffer)
277 (apply 'vc-svn-command
278 buffer 0 file
279 "cat"
280 (and rev (not (string= rev ""))
281 (concat "-r" rev))
282 (if (stringp vc-checkout-switches)
283 (list vc-checkout-switches)
284 vc-checkout-switches)))
286 (defun vc-svn-checkout (file &optional editable rev)
287 (message "Checking out %s..." file)
288 (with-current-buffer (or (get-file-buffer file) (current-buffer))
289 (let ((switches (if (stringp vc-checkout-switches)
290 (list vc-checkout-switches)
291 vc-checkout-switches)))
292 (vc-call update file editable rev switches)))
293 (vc-mode-line file)
294 (message "Checking out %s...done" file))
296 (defun vc-svn-update (file editable rev switches)
297 (if (and (file-exists-p file) (not rev))
298 ;; If no revision was specified, just make the file writable
299 ;; if necessary (using `svn-edit' if requested).
300 (and editable (not (eq (vc-svn-checkout-model file) 'implicit))
301 (if vc-svn-use-edit
302 (vc-svn-command nil 0 file "edit")
303 (set-file-modes file (logior (file-modes file) 128))
304 (if (equal file buffer-file-name) (toggle-read-only -1))))
305 ;; Check out a particular version (or recreate the file).
306 (vc-file-setprop file 'vc-workfile-version nil)
307 (apply 'vc-svn-command nil 0 file
308 "-w"
309 "update"
310 ;; default for verbose checkout: clear the sticky tag so
311 ;; that the actual update will get the head of the trunk
312 (if (or (not rev) (string= rev ""))
313 "-A"
314 (concat "-r" rev))
315 switches)))
317 (defun vc-svn-revert (file &optional contents-done)
318 "Revert FILE to the version it was based on."
319 (unless contents-done
320 (vc-svn-command nil 0 file "revert"))
321 (unless (eq (vc-checkout-model file) 'implicit)
322 (if vc-svn-use-edit
323 (vc-svn-command nil 0 file "unedit")
324 ;; Make the file read-only by switching off all w-bits
325 (set-file-modes file (logand (file-modes file) 3950)))))
327 (defun vc-svn-merge (file first-version &optional second-version)
328 "Merge changes into current working copy of FILE.
329 The changes are between FIRST-VERSION and SECOND-VERSION."
330 (vc-svn-command nil 0 file
331 "update" "-kk"
332 (concat "-j" first-version)
333 (concat "-j" second-version))
334 (vc-file-setprop file 'vc-state 'edited)
335 (with-current-buffer (get-buffer "*vc*")
336 (goto-char (point-min))
337 (if (re-search-forward "conflicts during merge" nil t)
338 1 ; signal error
339 0))) ; signal success
341 (defun vc-svn-merge-news (file)
342 "Merge in any new changes made to FILE."
343 (message "Merging changes into %s..." file)
344 ;; (vc-file-setprop file 'vc-workfile-version nil)
345 (vc-file-setprop file 'vc-checkout-time 0)
346 (vc-svn-command nil 0 file "update")
347 ;; Analyze the merge result reported by SVN, and set
348 ;; file properties accordingly.
349 (with-current-buffer (get-buffer "*vc*")
350 (goto-char (point-min))
351 ;; get new workfile version
352 (if (re-search-forward
353 "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t)
354 (vc-file-setprop file 'vc-workfile-version (match-string 1))
355 (vc-file-setprop file 'vc-workfile-version nil))
356 ;; get file status
357 (prog1
358 (if (eq (buffer-size) 0)
359 0 ;; there were no news; indicate success
360 (if (re-search-forward
361 (concat "^\\([CMUP] \\)?"
362 (regexp-quote (file-name-nondirectory file))
363 "\\( already contains the differences between \\)?")
364 nil t)
365 (cond
366 ;; Merge successful, we are in sync with repository now
367 ((or (match-string 2)
368 (string= (match-string 1) "U ")
369 (string= (match-string 1) "P "))
370 (vc-file-setprop file 'vc-state 'up-to-date)
371 (vc-file-setprop file 'vc-checkout-time
372 (nth 5 (file-attributes file)))
373 0);; indicate success to the caller
374 ;; Merge successful, but our own changes are still in the file
375 ((string= (match-string 1) "M ")
376 (vc-file-setprop file 'vc-state 'edited)
377 0);; indicate success to the caller
378 ;; Conflicts detected!
380 (vc-file-setprop file 'vc-state 'edited)
381 1);; signal the error to the caller
383 (pop-to-buffer "*vc*")
384 (error "Couldn't analyze svn update result")))
385 (message "Merging changes into %s...done" file))))
389 ;;; History functions
392 (defun vc-svn-print-log (file)
393 "Get change log associated with FILE."
394 (save-current-buffer
395 (vc-setup-buffer nil)
396 (let ((inhibit-read-only t))
397 (goto-char (point-min))
398 ;; Add a line to tell log-view-mode what file this is.
399 (insert "Working file: " (file-relative-name file) "\n"))
400 (vc-svn-command
402 (if (and (vc-svn-stay-local-p file) (fboundp 'start-process)) 'async 0)
403 file "log")))
405 (defun vc-svn-diff (file &optional oldvers newvers)
406 "Get a difference report using SVN between two versions of FILE."
407 (let (status (diff-switches-list (vc-diff-switches-list 'SVN)))
408 (if (string= (vc-workfile-version file) "0")
409 ;; This file is added but not yet committed; there is no master file.
410 (if (or oldvers newvers)
411 (error "No revisions of %s exist" file)
412 ;; We regard this as "changed".
413 ;; Diff it against /dev/null.
414 ;; Note: this is NOT a "svn diff".
415 (apply 'vc-do-command "*vc-diff*"
416 1 "diff" file
417 (append diff-switches-list '("/dev/null"))))
418 (setq status
419 (apply 'vc-svn-command "*vc-diff*"
420 (if (and (vc-svn-stay-local-p file)
421 (or oldvers newvers) ; Svn diffs those locally.
422 (fboundp 'start-process))
423 'async
425 file "diff"
426 (append
427 (when oldvers
428 (list "-r"
429 (if newvers (concat oldvers ":" newvers) oldvers)))
430 (when diff-switches-list
431 (list "-x" (mapconcat 'identity diff-switches-list " "))))))
432 (if (vc-svn-stay-local-p file)
433 1 ;; async diff, pessimistic assumption
434 status))))
436 (defun vc-svn-diff-tree (dir &optional rev1 rev2)
437 "Diff all files at and below DIR."
438 (with-current-buffer "*vc-diff*"
439 (setq default-directory dir)
440 (if (vc-svn-stay-local-p dir)
441 ;; local diff: do it filewise, and only for files that are modified
442 (vc-file-tree-walk
444 (lambda (f)
445 (vc-exec-after
446 `(let ((coding-system-for-read (vc-coding-system-for-diff ',f)))
447 ;; possible optimization: fetch the state of all files
448 ;; in the tree via vc-svn-dir-state-heuristic
449 (unless (vc-up-to-date-p ',f)
450 (message "Looking at %s" ',f)
451 (vc-diff-internal ',f ',rev1 ',rev2))))))
452 ;; svn diff: use a single call for the entire tree
453 (let ((coding-system-for-read (or coding-system-for-read 'undecided))
454 (diff-switches-list (vc-diff-switches-list 'SVN)))
455 (apply 'vc-svn-command "*vc-diff*" 1 nil "diff"
456 (append
457 (when oldvers
458 (list "-r"
459 (if rev2 (concat rev1 ":" rev2) rev1)))
460 (when diff-switches-list
461 (list "-x" (mapconcat 'identity diff-switches-list " ")))))))))
464 ;;; Snapshot system
467 (defun vc-svn-create-snapshot (dir name branchp)
468 "Assign to DIR's current version a given NAME.
469 If BRANCHP is non-nil, the name is created as a branch (and the current
470 workspace is immediately moved to that new branch)."
471 (vc-svn-command nil 0 dir "tag" "-c" (if branchp "-b") name)
472 (when branchp (vc-svn-command nil 0 dir "update" "-r" name)))
474 (defun vc-svn-retrieve-snapshot (dir name update)
475 "Retrieve a snapshot at and below DIR.
476 NAME is the name of the snapshot; if it is empty, do a `svn update'.
477 If UPDATE is non-nil, then update (resynch) any affected buffers."
478 (with-current-buffer (get-buffer-create "*vc*")
479 (let ((default-directory dir)
480 (sticky-tag))
481 (erase-buffer)
482 (if (or (not name) (string= name ""))
483 (vc-svn-command t 0 nil "update")
484 (vc-svn-command t 0 nil "update" "-r" name)
485 (setq sticky-tag name))
486 (when update
487 (goto-char (point-min))
488 (while (not (eobp))
489 (if (looking-at "\\([CMUP]\\) \\(.*\\)")
490 (let* ((file (expand-file-name (match-string 2) dir))
491 (state (match-string 1))
492 (buffer (find-buffer-visiting file)))
493 (when buffer
494 (cond
495 ((or (string= state "U")
496 (string= state "P"))
497 (vc-file-setprop file 'vc-state 'up-to-date)
498 (vc-file-setprop file 'vc-workfile-version nil)
499 (vc-file-setprop file 'vc-checkout-time
500 (nth 5 (file-attributes file))))
501 ((or (string= state "M")
502 (string= state "C"))
503 (vc-file-setprop file 'vc-state 'edited)
504 (vc-file-setprop file 'vc-workfile-version nil)
505 (vc-file-setprop file 'vc-checkout-time 0)))
506 (vc-file-setprop file 'vc-svn-sticky-tag sticky-tag)
507 (vc-resynch-buffer file t t))))
508 (forward-line 1))))))
512 ;;; Miscellaneous
515 ;; Subversion makes backups for us, so don't bother.
516 ;; (defalias 'vc-svn-make-version-backups-p 'vc-svn-stay-local-p
517 ;; "Return non-nil if version backups should be made for FILE.")
519 (defun vc-svn-check-headers ()
520 "Check if the current file has any headers in it."
521 (save-excursion
522 (goto-char (point-min))
523 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\
524 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t)))
528 ;;; Internal functions
531 (defun vc-svn-command (buffer okstatus file &rest flags)
532 "A wrapper around `vc-do-command' for use in vc-svn.el.
533 The difference to vc-do-command is that this function always invokes `svn',
534 and that it passes `vc-svn-global-switches' to it before FLAGS."
535 (apply 'vc-do-command buffer okstatus "svn" file
536 (if (stringp vc-svn-global-switches)
537 (cons vc-svn-global-switches flags)
538 (append vc-svn-global-switches
539 flags))))
541 (defun vc-svn-stay-local-p (file)
542 "Return non-nil if VC should stay local when handling FILE.
543 See `vc-svn-stay-local'."
544 (when vc-svn-stay-local
545 (let* ((dirname (if (file-directory-p file)
546 (directory-file-name file)
547 (file-name-directory file)))
548 (prop
549 (or (vc-file-getprop dirname 'vc-svn-stay-local-p)
550 (vc-file-setprop
551 dirname 'vc-svn-stay-local-p
552 (let ((rootname (expand-file-name ".svn/entries" dirname)))
553 (cond
554 ((not (file-readable-p rootname)) 'no)
555 ((stringp vc-svn-stay-local)
556 (with-temp-buffer
557 (let ((coding-system-for-read
558 (or file-name-coding-system
559 default-file-name-coding-system)))
560 (vc-insert-file rootname))
561 (goto-char (point-min))
562 (when (re-search-forward
563 (concat "name=\"svn:this_dir\"[\n\t ]*"
564 "url=\"\\([^\"]+\\)\"") nil t)
565 (let ((hostname (match-string 1)))
566 (if (not hostname)
568 (let* ((stay-local t)
570 (cond
571 ;; vc-svn-stay-local: rx
572 ((stringp vc-svn-stay-local)
573 vc-svn-stay-local)
574 ;; vc-svn-stay-local: '( [except] rx ... )
575 ((consp vc-svn-stay-local)
576 (mapconcat
577 'identity
578 (if (not (eq (car vc-svn-stay-local)
579 'except))
580 vc-svn-stay-local
581 (setq stay-local nil)
582 (cdr vc-svn-stay-local))
583 "\\|")))))
584 (if (not rx)
585 'yes
586 (if (not (string-match rx hostname))
587 (setq stay-local (not stay-local)))
588 (if stay-local
589 'yes
590 'no))))))))))))))
591 (if (eq prop 'yes) t nil))))
593 (defun vc-svn-parse-status (localp)
594 "Parse output of \"svn status\" command in the current buffer.
595 Set file properties accordingly. Unless FULL is t, parse only
596 essential information."
597 (let (file status)
598 (goto-char (point-min))
599 (while (re-search-forward
600 "^[ ADMCI?!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t)
601 (setq file (expand-file-name
602 (buffer-substring (point) (line-end-position))))
603 (setq status (char-after (line-beginning-position)))
604 (unless (eq status ??)
605 (vc-file-setprop file 'vc-backend 'SVN)
606 (vc-file-setprop file 'vc-workfile-version (match-string 2))
607 (vc-file-setprop
608 file 'vc-state
609 (cond
610 ((eq status ?\ )
611 (if (eq (char-after (match-beginning 1)) ?*)
612 'needs-patch
613 (vc-file-setprop file 'vc-checkout-time
614 (nth 5 (file-attributes file)))
615 'up-to-date))
616 ((eq status ?A)
617 (vc-file-setprop file 'vc-checkout-time 0)
618 'edited)
619 ((memq status '(?M ?C))
620 (if (eq (char-after (match-beginning 1)) ?*)
621 'needs-merge
622 'edited))
623 (t 'edited)))))))
625 (defun vc-svn-dir-state-heuristic (dir)
626 "Find the SVN state of all files in DIR, using only local information."
627 (vc-svn-dir-state dir 'local))
629 (defun vc-svn-valid-symbolic-tag-name-p (tag)
630 "Return non-nil if TAG is a valid symbolic tag name."
631 ;; According to the SVN manual, a valid symbolic tag must start with
632 ;; an uppercase or lowercase letter and can contain uppercase and
633 ;; lowercase letters, digits, `-', and `_'.
634 (and (string-match "^[a-zA-Z]" tag)
635 (not (string-match "[^a-z0-9A-Z-_]" tag))))
637 (defun vc-svn-valid-version-number-p (tag)
638 "Return non-nil if TAG is a valid version number."
639 (and (string-match "^[0-9]" tag)
640 (not (string-match "[^0-9]" tag))))
642 (provide 'vc-svn)
644 ;;; vc-svn.el ends here