annotate lisp/vc-svn.el @ 51265:575ad90ca254

(sh-here-document-word): Document new treatment of leading "-". (sh-maybe-here-document): Strip a leading "-" from closing heredoc delimiter, if present.
author Glenn Morris <rgm@gnu.org>
date Tue, 27 May 2003 18:40:31 +0000
parents c09edac18f97
children f43bd5204ab4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1 ;;; vc-svn.el --- non-resident support for Subversion version-control
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2
50999
c09edac18f97 (completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50927
diff changeset
3 ;; Copyright (C) 1995,98,99,2000,2001,02,2003 Free Software Foundation, Inc.
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
4
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
5 ;; Author: FSF (see vc.el for full credits)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
6 ;; Maintainer: Stefan Monnier <monnier@gnu.org>
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
7
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
9
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
13 ;; any later version.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
14
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
18 ;; GNU General Public License for more details.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
19
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
24
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
25 ;;; Commentary:
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
26
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
27 ;; This is preliminary support for Subversion (http://subversion.tigris.org/).
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
28 ;; It started as `sed s/cvs/svn/ vc.cvs.el' (from version 1.56)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
29 ;; and hasn't been completely fixed since.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
30
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
31 ;; Sync'd with Subversion's vc-svn.el as of revision 5801.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
32
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
33 ;;; Bugs:
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
34
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
35 ;; - VC-dired is (really) slow.
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
36
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
37 ;;; Code:
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
38
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
39 (eval-when-compile
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
40 (require 'vc))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
41
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
42 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
43 ;;; Customization options
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
44 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
45
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
46 (defcustom vc-svn-global-switches nil
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
47 "*Global switches to pass to any SVN command."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
48 :type '(choice (const :tag "None" nil)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
49 (string :tag "Argument String")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
50 (repeat :tag "Argument List"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
51 :value ("")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
52 string))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
53 :version "21.4"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
54 :group 'vc)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
55
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
56 (defcustom vc-svn-register-switches nil
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
57 "*Extra switches for registering a file into SVN.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
58 A string or list of strings passed to the checkin program by
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
59 \\[vc-register]."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
60 :type '(choice (const :tag "None" nil)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
61 (string :tag "Argument String")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
62 (repeat :tag "Argument List"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
63 :value ("")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
64 string))
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
65 :version "21.4"
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
66 :group 'vc)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
67
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
68 (defcustom vc-svn-diff-switches nil
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
69 "*A string or list of strings specifying extra switches for svn diff under VC."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
70 :type '(choice (const :tag "None" nil)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
71 (string :tag "Argument String")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
72 (repeat :tag "Argument List"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
73 :value ("")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
74 string))
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
75 :version "21.4"
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
76 :group 'vc)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
77
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
78 (defcustom vc-svn-header (or (cdr (assoc 'SVN vc-header-alist)) '("\$Id\$"))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
79 "*Header keywords to be inserted by `vc-insert-headers'."
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
80 :version "21.4"
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
81 :type '(repeat string)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
82 :group 'vc)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
83
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
84 (defcustom vc-svn-use-edit nil
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
85 "*Non-nil means to use `svn edit' to \"check out\" a file.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
86 This is only meaningful if you don't use the implicit checkout model
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
87 \(i.e. if you have $SVNREAD set)."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
88 :type 'boolean
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
89 :version "21.4"
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
90 :group 'vc)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
91
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
92 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
93 ;;; State-querying functions
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
94 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
95
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
96 ;;;###autoload (defun vc-svn-registered (f)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
97 ;;;###autoload (when (file-readable-p (expand-file-name
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
98 ;;;###autoload ".svn/entries" (file-name-directory f)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
99 ;;;###autoload (load "vc-svn")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
100 ;;;###autoload (vc-svn-registered f)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
101
50999
c09edac18f97 (completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50927
diff changeset
102 ;;;###autoload
c09edac18f97 (completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50927
diff changeset
103 (add-to-list 'completion-ignored-extensions ".svn/")
c09edac18f97 (completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50927
diff changeset
104
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
105 (defun vc-svn-registered (file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
106 "Check if FILE is SVN registered."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
107 (when (file-readable-p (expand-file-name ".svn/entries"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
108 (file-name-directory file)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
109 (with-temp-buffer
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
110 (cd (file-name-directory file))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
111 (condition-case nil
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
112 (vc-svn-command t 0 file "status" "-v")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
113 ;; We can't find an `svn' executable. We could also deregister SVN.
50820
fc3f65557bc8 (vc-svn-registered): Missing paren.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50818
diff changeset
114 (file-error nil))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
115 (vc-svn-parse-status t)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
116 (eq 'SVN (vc-file-getprop file 'vc-backend)))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
117
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
118 (defun vc-svn-state (file &optional localp)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
119 "SVN-specific version of `vc-state'."
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
120 (setq localp (or localp (vc-stay-local-p file)))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
121 (with-temp-buffer
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
122 (cd (file-name-directory file))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
123 (vc-svn-command t 0 file "status" (if localp "-v" "-u"))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
124 (vc-svn-parse-status localp)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
125 (vc-file-getprop file 'vc-state)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
126
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
127 (defun vc-svn-state-heuristic (file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
128 "SVN-specific state heuristic."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
129 (vc-svn-state file 'local))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
130
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
131 (defun vc-svn-dir-state (dir &optional localp)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
132 "Find the SVN state of all files in DIR."
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
133 (setq localp (or localp (vc-stay-local-p dir)))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
134 (let ((default-directory dir))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
135 ;; Don't specify DIR in this command, the default-directory is
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
136 ;; enough. Otherwise it might fail with remote repositories.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
137 (with-temp-buffer
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
138 (vc-svn-command t 0 nil "status" (if localp "-v" "-u"))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
139 (vc-svn-parse-status localp))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
140
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
141 (defun vc-svn-workfile-version (file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
142 "SVN-specific version of `vc-workfile-version'."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
143 ;; There is no need to consult RCS headers under SVN, because we
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
144 ;; get the workfile version for free when we recognize that a file
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
145 ;; is registered in SVN.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
146 (vc-svn-registered file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
147 (vc-file-getprop file 'vc-workfile-version))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
148
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
149 (defun vc-svn-checkout-model (file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
150 "SVN-specific version of `vc-checkout-model'."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
151 ;; It looks like Subversion has no equivalent of CVSREAD.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
152 'implicit)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
153
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
154 (defun vc-svn-dired-state-info (file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
155 "SVN-specific version of `vc-dired-state-info'."
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
156 (let ((svn-state (vc-state file)))
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
157 (cond ((eq svn-state 'edited)
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
158 (if (equal (vc-workfile-version file) "0")
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
159 "(added)" "(modified)"))
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
160 ((eq svn-state 'needs-patch) "(patch)")
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
161 ((eq svn-state 'needs-merge) "(merge)"))))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
162
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
163
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
164 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
165 ;;; State-changing functions
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
166 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
167
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
168 (defun vc-svn-register (file &optional rev comment)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
169 "Register FILE into the SVN version-control system.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
170 COMMENT can be used to provide an initial description of FILE.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
171
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
172 `vc-register-switches' and `vc-svn-register-switches' are passed to
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
173 the SVN command (in that order)."
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
174 (apply 'vc-svn-command nil 0 file
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
175 "add"
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
176 ;; (and comment (string-match "[^\t\n ]" comment)
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
177 ;; (concat "-m" comment))
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
178 (vc-switches 'SVN 'register)))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
179
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
180 (defun vc-svn-responsible-p (file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
181 "Return non-nil if SVN thinks it is responsible for FILE."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
182 (file-directory-p (expand-file-name ".svn"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
183 (if (file-directory-p file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
184 file
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
185 (file-name-directory file)))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
186
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
187 (defalias 'vc-svn-could-register 'vc-svn-responsible-p
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
188 "Return non-nil if FILE could be registered in SVN.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
189 This is only possible if SVN is responsible for FILE's directory.")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
190
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
191 (defun vc-svn-checkin (file rev comment)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
192 "SVN-specific version of `vc-backend-checkin'."
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
193 (let ((status (apply 'vc-svn-command nil 1 file
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
194 "ci" (list* "-m" comment (vc-switches 'SVN 'checkin)))))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
195 (set-buffer "*vc*")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
196 (goto-char (point-min))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
197 (unless (equal status 0)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
198 ;; Check checkin problem.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
199 (cond
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
200 ((search-forward "Transaction is out of date" nil t)
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
201 (vc-file-setprop file 'vc-state 'needs-merge)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
202 (error (substitute-command-keys
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
203 (concat "Up-to-date check failed: "
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
204 "type \\[vc-next-action] to merge in changes"))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
205 (t
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
206 (pop-to-buffer (current-buffer))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
207 (goto-char (point-min))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
208 (shrink-window-if-larger-than-buffer)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
209 (error "Check-in failed"))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
210 ;; Update file properties
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
211 ;; (vc-file-setprop
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
212 ;; file 'vc-workfile-version
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
213 ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
214 ))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
215
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
216 (defun vc-svn-find-version (file rev buffer)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
217 (apply 'vc-svn-command
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
218 buffer 0 file
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
219 "cat"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
220 (and rev (not (string= rev ""))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
221 (concat "-r" rev))
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
222 (vc-switches 'SVN 'checkout)))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
223
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
224 (defun vc-svn-checkout (file &optional editable rev)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
225 (message "Checking out %s..." file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
226 (with-current-buffer (or (get-file-buffer file) (current-buffer))
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
227 (vc-call update file editable rev (vc-switches 'SVN 'checkout)))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
228 (vc-mode-line file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
229 (message "Checking out %s...done" file))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
230
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
231 (defun vc-svn-update (file editable rev switches)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
232 (if (and (file-exists-p file) (not rev))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
233 ;; If no revision was specified, just make the file writable
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
234 ;; if necessary (using `svn-edit' if requested).
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
235 (and editable (not (eq (vc-svn-checkout-model file) 'implicit))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
236 (if vc-svn-use-edit
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
237 (vc-svn-command nil 0 file "edit")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
238 (set-file-modes file (logior (file-modes file) 128))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
239 (if (equal file buffer-file-name) (toggle-read-only -1))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
240 ;; Check out a particular version (or recreate the file).
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
241 (vc-file-setprop file 'vc-workfile-version nil)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
242 (apply 'vc-svn-command nil 0 file
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
243 "-w"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
244 "update"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
245 ;; default for verbose checkout: clear the sticky tag so
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
246 ;; that the actual update will get the head of the trunk
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
247 (if (or (not rev) (string= rev ""))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
248 "-A"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
249 (concat "-r" rev))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
250 switches)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
251
50999
c09edac18f97 (completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50927
diff changeset
252 (defun vc-svn-delete-file (file)
c09edac18f97 (completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50927
diff changeset
253 (vc-svn-command nil 0 file "remove"))
c09edac18f97 (completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50927
diff changeset
254
50922
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
255 (defun vc-svn-rename-file (old new)
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
256 (vc-svn-command nil 0 new "move" (file-relative-name old)))
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
257
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
258 (defun vc-svn-revert (file &optional contents-done)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
259 "Revert FILE to the version it was based on."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
260 (unless contents-done
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
261 (vc-svn-command nil 0 file "revert"))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
262 (unless (eq (vc-checkout-model file) 'implicit)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
263 (if vc-svn-use-edit
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
264 (vc-svn-command nil 0 file "unedit")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
265 ;; Make the file read-only by switching off all w-bits
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
266 (set-file-modes file (logand (file-modes file) 3950)))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
267
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
268 (defun vc-svn-merge (file first-version &optional second-version)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
269 "Merge changes into current working copy of FILE.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
270 The changes are between FIRST-VERSION and SECOND-VERSION."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
271 (vc-svn-command nil 0 file
50822
0be6233722ec (vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50821
diff changeset
272 "merge"
50823
83c8010f1eb2 (vc-svn-merge): Forgot quotes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50822
diff changeset
273 "-r" (if second-version
50822
0be6233722ec (vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50821
diff changeset
274 (concat first-version ":" second-version)
0be6233722ec (vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50821
diff changeset
275 first-version))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
276 (vc-file-setprop file 'vc-state 'edited)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
277 (with-current-buffer (get-buffer "*vc*")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
278 (goto-char (point-min))
50822
0be6233722ec (vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50821
diff changeset
279 (if (looking-at "C ")
0be6233722ec (vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50821
diff changeset
280 1 ; signal conflict
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
281 0))) ; signal success
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
282
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
283 (defun vc-svn-merge-news (file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
284 "Merge in any new changes made to FILE."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
285 (message "Merging changes into %s..." file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
286 ;; (vc-file-setprop file 'vc-workfile-version nil)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
287 (vc-file-setprop file 'vc-checkout-time 0)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
288 (vc-svn-command nil 0 file "update")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
289 ;; Analyze the merge result reported by SVN, and set
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
290 ;; file properties accordingly.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
291 (with-current-buffer (get-buffer "*vc*")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
292 (goto-char (point-min))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
293 ;; get new workfile version
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
294 (if (re-search-forward
50821
33e415a24bb5 (vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50820
diff changeset
295 "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t)
33e415a24bb5 (vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50820
diff changeset
296 (vc-file-setprop file 'vc-workfile-version (match-string 2))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
297 (vc-file-setprop file 'vc-workfile-version nil))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
298 ;; get file status
50821
33e415a24bb5 (vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50820
diff changeset
299 (goto-char (point-min))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
300 (prog1
50821
33e415a24bb5 (vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50820
diff changeset
301 (if (looking-at "At revision")
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
302 0 ;; there were no news; indicate success
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
303 (if (re-search-forward
50821
33e415a24bb5 (vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50820
diff changeset
304 (concat "^\\([CGDU] \\)?"
33e415a24bb5 (vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50820
diff changeset
305 (regexp-quote (file-name-nondirectory file)))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
306 nil t)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
307 (cond
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
308 ;; Merge successful, we are in sync with repository now
50821
33e415a24bb5 (vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50820
diff changeset
309 ((string= (match-string 1) "U ")
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
310 (vc-file-setprop file 'vc-state 'up-to-date)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
311 (vc-file-setprop file 'vc-checkout-time
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
312 (nth 5 (file-attributes file)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
313 0);; indicate success to the caller
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
314 ;; Merge successful, but our own changes are still in the file
50821
33e415a24bb5 (vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50820
diff changeset
315 ((string= (match-string 1) "G ")
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
316 (vc-file-setprop file 'vc-state 'edited)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
317 0);; indicate success to the caller
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
318 ;; Conflicts detected!
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
319 (t
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
320 (vc-file-setprop file 'vc-state 'edited)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
321 1);; signal the error to the caller
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
322 )
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
323 (pop-to-buffer "*vc*")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
324 (error "Couldn't analyze svn update result")))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
325 (message "Merging changes into %s...done" file))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
326
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
327
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
328 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
329 ;;; History functions
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
330 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
331
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
332 (defun vc-svn-print-log (file)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
333 "Get change log associated with FILE."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
334 (save-current-buffer
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
335 (vc-setup-buffer nil)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
336 (let ((inhibit-read-only t))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
337 (goto-char (point-min))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
338 ;; Add a line to tell log-view-mode what file this is.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
339 (insert "Working file: " (file-relative-name file) "\n"))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
340 (vc-svn-command
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
341 t
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
342 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0)
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
343 file "log")))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
344
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
345 (defun vc-svn-diff (file &optional oldvers newvers)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
346 "Get a difference report using SVN between two versions of FILE."
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
347 (if (string= (vc-workfile-version file) "0")
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
348 ;; This file is added but not yet committed; there is no master file.
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
349 (if (or oldvers newvers)
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
350 (error "No revisions of %s exist" file)
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
351 ;; We regard this as "changed".
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
352 ;; Diff it against /dev/null.
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
353 ;; Note: this is NOT a "svn diff".
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
354 (apply 'vc-do-command "*vc-diff*"
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
355 1 "diff" file
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
356 (append (vc-switches nil 'diff) '("/dev/null")))
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
357 ;; Even if it's empty, it's locally modified.
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
358 1)
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
359 (let* ((switches (vc-switches 'SVN 'diff))
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
360 (async (and (vc-stay-local-p file)
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
361 (or oldvers newvers) ; Svn diffs those locally.
50922
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
362 (fboundp 'start-process))))
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
363 (apply 'vc-svn-command "*vc-diff*"
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
364 (if async 'async 0)
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
365 file "diff"
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
366 (append
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
367 (when switches
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
368 (list "-x" (mapconcat 'identity switches " ")))
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
369 (when oldvers
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
370 (list "-r" (if newvers (concat oldvers ":" newvers)
bdc62a6694f7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50900
diff changeset
371 oldvers)))))
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
372 (if async 1 ; async diff => pessimistic assumption
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
373 ;; For some reason `svn diff' does not return a useful
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
374 ;; status w.r.t whether the diff was empty or not.
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
375 (buffer-size (get-buffer "*vc-diff*"))))))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
376
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
377 (defun vc-svn-diff-tree (dir &optional rev1 rev2)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
378 "Diff all files at and below DIR."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
379 (with-current-buffer "*vc-diff*"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
380 (setq default-directory dir)
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
381 (if (vc-stay-local-p dir)
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
382 ;; local diff: do it filewise, and only for files that are modified
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
383 (vc-file-tree-walk
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
384 dir
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
385 (lambda (f)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
386 (vc-exec-after
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
387 `(let ((coding-system-for-read (vc-coding-system-for-diff ',f)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
388 ;; possible optimization: fetch the state of all files
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
389 ;; in the tree via vc-svn-dir-state-heuristic
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
390 (unless (vc-up-to-date-p ',f)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
391 (message "Looking at %s" ',f)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
392 (vc-diff-internal ',f ',rev1 ',rev2))))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
393 ;; svn diff: use a single call for the entire tree
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
394 (let ((coding-system-for-read (or coding-system-for-read 'undecided))
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
395 (switches (vc-switches 'SVN 'diff)))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
396 (apply 'vc-svn-command "*vc-diff*" 1 nil "diff"
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
397 (append
50820
fc3f65557bc8 (vc-svn-registered): Missing paren.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50818
diff changeset
398 (when rev1
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
399 (list "-r" (if rev2 (concat rev1 ":" rev2) rev1)))
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
400 (when switches
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
401 (list "-x" (mapconcat 'identity switches " ")))))))))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
402
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
403 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
404 ;;; Snapshot system
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
405 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
406
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
407 (defun vc-svn-create-snapshot (dir name branchp)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
408 "Assign to DIR's current version a given NAME.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
409 If BRANCHP is non-nil, the name is created as a branch (and the current
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
410 workspace is immediately moved to that new branch)."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
411 (vc-svn-command nil 0 dir "tag" "-c" (if branchp "-b") name)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
412 (when branchp (vc-svn-command nil 0 dir "update" "-r" name)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
413
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
414 (defun vc-svn-retrieve-snapshot (dir name update)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
415 "Retrieve a snapshot at and below DIR.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
416 NAME is the name of the snapshot; if it is empty, do a `svn update'.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
417 If UPDATE is non-nil, then update (resynch) any affected buffers."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
418 (with-current-buffer (get-buffer-create "*vc*")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
419 (let ((default-directory dir)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
420 (sticky-tag))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
421 (erase-buffer)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
422 (if (or (not name) (string= name ""))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
423 (vc-svn-command t 0 nil "update")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
424 (vc-svn-command t 0 nil "update" "-r" name)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
425 (setq sticky-tag name))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
426 (when update
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
427 (goto-char (point-min))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
428 (while (not (eobp))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
429 (if (looking-at "\\([CMUP]\\) \\(.*\\)")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
430 (let* ((file (expand-file-name (match-string 2) dir))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
431 (state (match-string 1))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
432 (buffer (find-buffer-visiting file)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
433 (when buffer
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
434 (cond
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
435 ((or (string= state "U")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
436 (string= state "P"))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
437 (vc-file-setprop file 'vc-state 'up-to-date)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
438 (vc-file-setprop file 'vc-workfile-version nil)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
439 (vc-file-setprop file 'vc-checkout-time
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
440 (nth 5 (file-attributes file))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
441 ((or (string= state "M")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
442 (string= state "C"))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
443 (vc-file-setprop file 'vc-state 'edited)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
444 (vc-file-setprop file 'vc-workfile-version nil)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
445 (vc-file-setprop file 'vc-checkout-time 0)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
446 (vc-file-setprop file 'vc-svn-sticky-tag sticky-tag)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
447 (vc-resynch-buffer file t t))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
448 (forward-line 1))))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
449
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
450
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
451 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
452 ;;; Miscellaneous
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
453 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
454
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
455 ;; Subversion makes backups for us, so don't bother.
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
456 ;; (defalias 'vc-svn-make-version-backups-p 'vc-stay-local-p
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
457 ;; "Return non-nil if version backups should be made for FILE.")
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
458
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
459 (defun vc-svn-check-headers ()
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
460 "Check if the current file has any headers in it."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
461 (save-excursion
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
462 (goto-char (point-min))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
463 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
464 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
465
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
466
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
467 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
468 ;;; Internal functions
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
469 ;;;
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
470
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
471 (defun vc-svn-command (buffer okstatus file &rest flags)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
472 "A wrapper around `vc-do-command' for use in vc-svn.el.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
473 The difference to vc-do-command is that this function always invokes `svn',
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
474 and that it passes `vc-svn-global-switches' to it before FLAGS."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
475 (apply 'vc-do-command buffer okstatus "svn" file
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
476 (if (stringp vc-svn-global-switches)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
477 (cons vc-svn-global-switches flags)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
478 (append vc-svn-global-switches
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
479 flags))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
480
50927
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
481 (defun vc-svn-repository-hostname (dirname)
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
482 (with-temp-buffer
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
483 (let ((coding-system-for-read
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
484 (or file-name-coding-system
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
485 default-file-name-coding-system)))
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
486 (vc-insert-file (expand-file-name ".svn/entries" dirname)))
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
487 (goto-char (point-min))
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
488 (when (re-search-forward
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
489 (concat "name=\"svn:this_dir\"[\n\t ]*"
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
490 "\\([-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?"
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
491 "url=\"\\([^\"]+\\)\"") nil t)
6f478e2878c7 (vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50922
diff changeset
492 (match-string 2))))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
493
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
494 (defun vc-svn-parse-status (localp)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
495 "Parse output of \"svn status\" command in the current buffer.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
496 Set file properties accordingly. Unless FULL is t, parse only
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
497 essential information."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
498 (let (file status)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
499 (goto-char (point-min))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
500 (while (re-search-forward
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
501 "^[ ADMCI?!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t)
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
502 (setq file (expand-file-name
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
503 (buffer-substring (point) (line-end-position))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
504 (setq status (char-after (line-beginning-position)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
505 (unless (eq status ??)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
506 (vc-file-setprop file 'vc-backend 'SVN)
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
507 ;; Use the last-modified revision, so that searching in vc-print-log
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
508 ;; output works.
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
509 (vc-file-setprop file 'vc-workfile-version (match-string 3))
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
510 (vc-file-setprop
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
511 file 'vc-state
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
512 (cond
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
513 ((eq status ?\ )
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
514 (if (eq (char-after (match-beginning 1)) ?*)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
515 'needs-patch
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
516 (vc-file-setprop file 'vc-checkout-time
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
517 (nth 5 (file-attributes file)))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
518 'up-to-date))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
519 ((eq status ?A)
50900
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
520 ;; If the file was actually copied, (match-string 2) is "-".
d853a98e1678 (vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50823
diff changeset
521 (vc-file-setprop file 'vc-workfile-version "0")
50818
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
522 (vc-file-setprop file 'vc-checkout-time 0)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
523 'edited)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
524 ((memq status '(?M ?C))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
525 (if (eq (char-after (match-beginning 1)) ?*)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
526 'needs-merge
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
527 'edited))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
528 (t 'edited)))))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
529
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
530 (defun vc-svn-dir-state-heuristic (dir)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
531 "Find the SVN state of all files in DIR, using only local information."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
532 (vc-svn-dir-state dir 'local))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
533
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
534 (defun vc-svn-valid-symbolic-tag-name-p (tag)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
535 "Return non-nil if TAG is a valid symbolic tag name."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
536 ;; According to the SVN manual, a valid symbolic tag must start with
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
537 ;; an uppercase or lowercase letter and can contain uppercase and
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
538 ;; lowercase letters, digits, `-', and `_'.
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
539 (and (string-match "^[a-zA-Z]" tag)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
540 (not (string-match "[^a-z0-9A-Z-_]" tag))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
541
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
542 (defun vc-svn-valid-version-number-p (tag)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
543 "Return non-nil if TAG is a valid version number."
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
544 (and (string-match "^[0-9]" tag)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
545 (not (string-match "[^0-9]" tag))))
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
546
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
547 (provide 'vc-svn)
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
548
d3acfb11487e First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
549 ;;; vc-svn.el ends here