Mercurial > emacs
annotate lisp/vc-mcvs.el @ 50958:d20464e3d617
(cvs-minor-current-files): Move before first use.
(defun-cvs-mode): Remove unused var `restdoc'.
(cvs-edit-log-revision, ediff-after-quit-hook-internal): Declare.
(cvs-mode-diff-backup): Remove unused var `filter'.
(cvs-mode-run): Remove unused var `cvs-buf'.
(cvs-mode-do): Remove unused arg `parse'.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 12 May 2003 18:16:43 +0000 |
parents | 1731748fbe8c |
children | 575459cc44fb |
rev | line source |
---|---|
50646 | 1 ;;; vc-mcvs.el --- VC backend for the Meta-CVS version-control system |
2 | |
3 ;; Copyright (C) 1995,98,99,2000,01,02,2003 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: FSF (see vc.el for full credits) | |
6 ;; Maintainer: Stefan Monnier <monnier@gnu.org> | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
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. | |
14 | |
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. | |
19 | |
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. | |
24 | |
25 ;;; Commentary: | |
26 | |
50779
02455099d549
Add a link to Meta-CVS home page.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50667
diff
changeset
|
27 ;; The home page of the Meta-CVS version control system is at |
02455099d549
Add a link to Meta-CVS home page.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50667
diff
changeset
|
28 ;; |
02455099d549
Add a link to Meta-CVS home page.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50667
diff
changeset
|
29 ;; http://users.footprints.net/~kaz/mcvs.html |
02455099d549
Add a link to Meta-CVS home page.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50667
diff
changeset
|
30 ;; |
50646 | 31 ;; This is derived from vc-cvs.el as follows: |
32 ;; - cp vc-cvs.el vc-mcvs.el | |
33 ;; - Replace CVS/ with MCVS/CVS/ | |
34 ;; - Replace 'CVS with 'MCVS | |
35 ;; - Replace -cvs- with -mcvs- | |
36 ;; - Replace most of the rest of CVS to Meta-CVS | |
37 ;; | |
38 ;; Then of course started the hacking. Only a small part of the code | |
39 ;; has been touched and not much more than that was tested, so if | |
40 ;; you bump into a bug, don't be surprised: just report it to me. | |
41 ;; | |
42 ;; What has been partly tested: | |
43 ;; - C-x v v to start editing a file that was checked out with CVSREAD on. | |
44 ;; - C-x v v to commit a file | |
45 ;; - C-x v = | |
46 ;; - C-x v l | |
47 ;; - C-x v i | |
48 ;; - C-x v g | |
50808
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
49 ;; - M-x vc-rename-file RET |
50646 | 50 |
51 ;;; Bugs: | |
52 | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
53 ;; - Retrieving snapshots doesn't filter `cvs update' output and thus |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
54 ;; parses bogus filenames. Don't know if it harms. |
50646 | 55 |
56 ;;; Code: | |
57 | |
58 (eval-when-compile (require 'vc)) | |
59 (require 'vc-cvs) | |
60 | |
61 ;;; | |
62 ;;; Customization options | |
63 ;;; | |
64 | |
65 (defcustom vc-mcvs-global-switches nil | |
66 "*Global switches to pass to any Meta-CVS command." | |
67 :type '(choice (const :tag "None" nil) | |
68 (string :tag "Argument String") | |
69 (repeat :tag "Argument List" | |
70 :value ("") | |
71 string)) | |
72 :version "21.4" | |
73 :group 'vc) | |
74 | |
75 (defcustom vc-mcvs-register-switches nil | |
76 "*Extra switches for registering a file into Meta-CVS. | |
77 A string or list of strings passed to the checkin program by | |
78 \\[vc-register]." | |
79 :type '(choice (const :tag "None" nil) | |
80 (string :tag "Argument String") | |
81 (repeat :tag "Argument List" | |
82 :value ("") | |
83 string)) | |
84 :version "21.4" | |
85 :group 'vc) | |
86 | |
87 (defcustom vc-mcvs-diff-switches nil | |
88 "*A string or list of strings specifying extra switches for cvs diff under VC." | |
89 :type '(choice (const :tag "None" nil) | |
90 (string :tag "Argument String") | |
91 (repeat :tag "Argument List" | |
92 :value ("") | |
93 string)) | |
94 :version "21.4" | |
95 :group 'vc) | |
96 | |
97 (defcustom vc-mcvs-header (or (cdr (assoc 'MCVS vc-header-alist)) | |
98 vc-cvs-header) | |
99 "*Header keywords to be inserted by `vc-insert-headers'." | |
100 :version "21.4" | |
101 :type '(repeat string) | |
102 :group 'vc) | |
103 | |
104 (defcustom vc-mcvs-use-edit vc-cvs-use-edit | |
105 "*Non-nil means to use `cvs edit' to \"check out\" a file. | |
106 This is only meaningful if you don't use the implicit checkout model | |
107 \(i.e. if you have $CVSREAD set)." | |
108 :type 'boolean | |
109 :version "21.4" | |
110 :group 'vc) | |
111 | |
112 ;;; | |
113 ;;; State-querying functions | |
114 ;;; | |
115 | |
116 ;;;###autoload (defun vc-mcvs-registered (file) | |
117 ;;;###autoload (let ((dir file)) | |
118 ;;;###autoload (while (and (stringp dir) | |
119 ;;;###autoload (not (equal dir (setq dir (file-name-directory dir))))) | |
120 ;;;###autoload (setq dir (if (file-directory-p | |
121 ;;;###autoload (expand-file-name "MCVS/CVS" dir)) | |
122 ;;;###autoload t (directory-file-name dir)))) | |
123 ;;;###autoload (if (eq dir t) | |
124 ;;;###autoload (progn | |
125 ;;;###autoload (load "vc-mcvs") | |
126 ;;;###autoload (vc-mcvs-registered file))))) | |
127 | |
128 (defun vc-mcvs-root (file) | |
129 "Return the root directory of a Meta-CVS project, if any." | |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
130 (or (vc-file-getprop file 'mcvs-root) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
131 (vc-file-setprop |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
132 file 'mcvs-root |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
133 (let ((root nil)) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
134 (while (not (or root |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
135 (equal file (setq file (file-name-directory file))))) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
136 (if (file-directory-p (expand-file-name "MCVS/CVS" file)) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
137 (setq root file) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
138 (setq file (directory-file-name file)))) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
139 root)))) |
50646 | 140 |
141 (defun vc-mcvs-read (file) | |
50899
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
142 (if (file-readable-p file) |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
143 (with-temp-buffer |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
144 (insert-file-contents file) |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
145 (goto-char (point-min)) |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
146 (read (current-buffer))))) |
50646 | 147 |
148 (defun vc-mcvs-map-file (dir file) | |
149 (let ((map (vc-mcvs-read (expand-file-name "MCVS/MAP" dir))) | |
150 inode) | |
151 (dolist (x map inode) | |
152 (if (equal (nth 2 x) file) (setq inode (nth 1 x)))))) | |
153 | |
154 (defun vc-mcvs-registered (file) | |
155 (let (root inode cvsfile) | |
156 (when (and (setq root (vc-mcvs-root file)) | |
157 (setq inode (vc-mcvs-map-file | |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
158 root (file-relative-name file root)))) |
50646 | 159 (vc-file-setprop file 'mcvs-inode inode) |
160 ;; Avoid calling `mcvs diff' in vc-workfile-unchanged-p. | |
161 (vc-file-setprop file 'vc-checkout-time | |
162 (if (vc-cvs-registered | |
163 (setq cvsfile (expand-file-name inode root))) | |
164 (vc-file-getprop cvsfile 'vc-checkout-time) | |
165 ;; The file might not be registered yet because | |
166 ;; of lazy-adding. | |
167 0)) | |
168 t))) | |
169 | |
170 (defmacro vc-mcvs-cvs (op file &rest args) | |
171 (declare (debug t)) | |
172 `(,(intern (concat "vc-cvs-" (symbol-name op))) | |
173 (expand-file-name (vc-file-getprop ,file 'mcvs-inode) | |
174 (vc-file-getprop ,file 'mcvs-root)) | |
175 ,@args)) | |
176 | |
177 (defun vc-mcvs-state (file) | |
178 ;; This would assume the Meta-CVS sandbox is synchronized. | |
179 ;; (vc-mcvs-cvs state file)) | |
180 "Meta-CVS-specific version of `vc-state'." | |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
181 (if (vc-stay-local-p file) |
50646 | 182 (let ((state (vc-file-getprop file 'vc-state))) |
183 ;; If we should stay local, use the heuristic but only if | |
184 ;; we don't have a more precise state already available. | |
185 (if (memq state '(up-to-date edited)) | |
186 (vc-mcvs-state-heuristic file) | |
187 state)) | |
188 (with-temp-buffer | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
189 (setq default-directory (vc-mcvs-root file)) |
50646 | 190 (vc-mcvs-command t 0 file "status") |
191 (vc-cvs-parse-status t)))) | |
192 | |
193 | |
194 (defalias 'vc-mcvs-state-heuristic 'vc-cvs-state-heuristic) | |
195 | |
196 (defun vc-mcvs-dir-state (dir) | |
197 "Find the Meta-CVS state of all files in DIR." | |
198 ;; if DIR is not under Meta-CVS control, don't do anything. | |
199 (when (file-readable-p (expand-file-name "MCVS/CVS/Entries" dir)) | |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
200 (if (vc-stay-local-p dir) |
50646 | 201 (vc-mcvs-dir-state-heuristic dir) |
202 (let ((default-directory dir)) | |
203 ;; Don't specify DIR in this command, the default-directory is | |
204 ;; enough. Otherwise it might fail with remote repositories. | |
205 (with-temp-buffer | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
206 (setq default-directory (vc-mcvs-root dir)) |
50646 | 207 (vc-mcvs-command t 0 nil "status" "-l") |
208 (goto-char (point-min)) | |
209 (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) | |
210 (narrow-to-region (match-beginning 0) (match-end 0)) | |
211 (vc-cvs-parse-status) | |
212 (goto-char (point-max)) | |
213 (widen))))))) | |
214 | |
215 (defun vc-mcvs-workfile-version (file) (vc-mcvs-cvs workfile-version file)) | |
216 | |
217 (defalias 'vc-mcvs-checkout-model 'vc-cvs-checkout-model) | |
218 | |
50808
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
219 (defun vc-mcvs-mode-line-string (file) |
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
220 (let ((s (vc-mcvs-cvs mode-line-string file))) |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
221 (when s |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
222 (if (and (not (memq (vc-state file) '(up-to-date needs-patch))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
223 (string-match "\\`CVS-" s)) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
224 ;; The CVS file is not in sync, so we need to adjust the state. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
225 (concat "MCVS:" (substring s 4)) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
226 (concat "M" s))))) |
50646 | 227 |
228 ;;; | |
229 ;;; State-changing functions | |
230 ;;; | |
231 | |
232 (defun vc-mcvs-register (file &optional rev comment) | |
233 "Register FILE into the Meta-CVS version-control system. | |
234 COMMENT can be used to provide an initial description of FILE. | |
235 | |
236 `vc-register-switches' and `vc-mcvs-register-switches' are passed to | |
237 the Meta-CVS command (in that order)." | |
238 (let* ((filename (file-name-nondirectory file)) | |
239 (extpos (string-match "\\." filename)) | |
240 (ext (if extpos (substring filename (1+ extpos)))) | |
241 (root (vc-mcvs-root file)) | |
242 (types-file (expand-file-name "MCVS/TYPES" root)) | |
243 (map-file (expand-file-name "MCVS/MAP" root)) | |
244 (types (vc-mcvs-read types-file))) | |
245 ;; Make sure meta files like MCVS/MAP are not read-only (happens with | |
246 ;; CVSREAD) since Meta-CVS doesn't pay attention to it at all and goes | |
247 ;; belly-up. | |
248 (unless (file-writable-p map-file) | |
249 (vc-checkout map-file t)) | |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
250 (unless (or (file-writable-p types-file) (not (file-exists-p types-file))) |
50646 | 251 (vc-checkout types-file t)) |
252 ;; Make sure the `mcvs add' will not fire up the CVSEDITOR | |
253 ;; to add a rule for the given file's extension. | |
254 (when (and ext (not (assoc ext types))) | |
255 (let ((type (completing-read "Type to use [default]: " | |
256 '("default" "name-only" "keep-old" | |
257 "binary" "value-only") | |
258 nil t nil nil "default"))) | |
259 (push (list ext (make-symbol (upcase (concat ":" type)))) types) | |
260 (setq types (sort types (lambda (x y) (string< (car x) (car y))))) | |
261 (with-current-buffer (find-file-noselect types-file) | |
262 (erase-buffer) | |
263 (pp types (current-buffer)) | |
264 (save-buffer) | |
265 (unless (get-buffer-window (current-buffer) t) | |
266 (kill-buffer (current-buffer))))))) | |
267 ;; Now do the ADD. | |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
268 (prog1 (apply 'vc-mcvs-command nil 0 file |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
269 "add" |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
270 (and comment (string-match "[^\t\n ]" comment) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
271 (concat "-m" comment)) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
272 (vc-switches 'MCVS 'register)) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
273 ;; I'm not sure exactly why, but if we don't setup the inode and root |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
274 ;; prop of the file, things break later on in vc-mode-line that |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
275 ;; ends up calling vc-mcvs-workfile-version. |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
276 ;; We also need to set vc-checkout-time so that vc-workfile-unchanged-p |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
277 ;; doesn't try to call `mcvs diff' on the file. |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
278 (vc-mcvs-registered file))) |
50646 | 279 |
280 (defalias 'vc-mcvs-responsible-p 'vc-mcvs-root | |
281 "Return non-nil if CVS thinks it is responsible for FILE.") | |
282 | |
283 (defalias 'vc-cvs-could-register 'vc-cvs-responsible-p | |
284 "Return non-nil if FILE could be registered in Meta-CVS. | |
285 This is only possible if Meta-CVS is responsible for FILE's directory.") | |
286 | |
287 (defun vc-mcvs-checkin (file rev comment) | |
288 "Meta-CVS-specific version of `vc-backend-checkin'." | |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
289 (unless (or (not rev) (vc-mcvs-valid-version-number-p rev)) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
290 (if (not (vc-mcvs-valid-symbolic-tag-name-p rev)) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
291 (error "%s is not a valid symbolic tag name" rev) |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
292 ;; If the input revision is a valid symbolic tag name, we create it |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
293 ;; as a branch, commit and switch to it. |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
294 ;; This file-specific form of branching is deprecated. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
295 ;; We can't use `mcvs branch' and `mcvs switch' because they cannot |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
296 ;; be applied just to this one file. |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
297 (apply 'vc-mcvs-command nil 0 file "tag" "-b" (list rev)) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
298 (apply 'vc-mcvs-command nil 0 file "update" "-r" (list rev)) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
299 (vc-file-setprop file 'vc-mcvs-sticky-tag rev) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
300 (setq rev nil))) |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
301 ;; This commit might cvs-commit several files (e.g. MAP and TYPES) |
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
302 ;; so using numbered revs here is dangerous and somewhat meaningless. |
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
303 (when rev (error "Cannot commit to a specific revision number")) |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
304 (let ((status (apply 'vc-mcvs-command nil 1 file |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
305 "ci" "-m" comment |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
306 (vc-switches 'MCVS 'checkin)))) |
50646 | 307 (set-buffer "*vc*") |
308 (goto-char (point-min)) | |
309 (when (not (zerop status)) | |
310 ;; Check checkin problem. | |
311 (cond | |
312 ((re-search-forward "Up-to-date check failed" nil t) | |
313 (vc-file-setprop file 'vc-state 'needs-merge) | |
314 (error (substitute-command-keys | |
315 (concat "Up-to-date check failed: " | |
316 "type \\[vc-next-action] to merge in changes")))) | |
317 (t | |
318 (pop-to-buffer (current-buffer)) | |
319 (goto-char (point-min)) | |
320 (shrink-window-if-larger-than-buffer) | |
321 (error "Check-in failed")))) | |
322 ;; Update file properties | |
323 (vc-file-setprop | |
324 file 'vc-workfile-version | |
325 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) | |
326 ;; Forget the checkout model of the file, because we might have | |
327 ;; guessed wrong when we found the file. After commit, we can | |
328 ;; tell it from the permissions of the file (see | |
329 ;; vc-mcvs-checkout-model). | |
330 (vc-file-setprop file 'vc-checkout-model nil) | |
331 | |
332 ;; if this was an explicit check-in (does not include creation of | |
333 ;; a branch), remove the sticky tag. | |
334 (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev))) | |
335 (vc-mcvs-command nil 0 file "update" "-A")))) | |
336 | |
337 (defun vc-mcvs-find-version (file rev buffer) | |
338 (apply 'vc-mcvs-command | |
339 buffer 0 file | |
340 "-Q" ; suppress diagnostic output | |
341 "update" | |
342 (and rev (not (string= rev "")) | |
343 (concat "-r" rev)) | |
344 "-p" | |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
345 (vc-switches 'MCVS 'checkout))) |
50646 | 346 |
347 (defun vc-mcvs-checkout (file &optional editable rev) | |
348 (message "Checking out %s..." file) | |
349 (with-current-buffer (or (get-file-buffer file) (current-buffer)) | |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
350 (vc-call update file editable rev (vc-switches 'MCVS 'checkout))) |
50646 | 351 (vc-mode-line file) |
352 (message "Checking out %s...done" file)) | |
353 | |
354 (defun vc-mcvs-update (file editable rev switches) | |
355 (if (and (file-exists-p file) (not rev)) | |
356 ;; If no revision was specified, just make the file writable | |
357 ;; if necessary (using `cvs-edit' if requested). | |
358 (and editable (not (eq (vc-mcvs-checkout-model file) 'implicit)) | |
359 (if vc-mcvs-use-edit | |
360 (vc-mcvs-command nil 0 file "edit") | |
361 (set-file-modes file (logior (file-modes file) 128)) | |
362 (if (equal file buffer-file-name) (toggle-read-only -1)))) | |
363 ;; Check out a particular version (or recreate the file). | |
364 (vc-file-setprop file 'vc-workfile-version nil) | |
365 (apply 'vc-mcvs-command nil 0 file | |
366 (if editable "-w") | |
367 "update" | |
368 ;; default for verbose checkout: clear the sticky tag so | |
369 ;; that the actual update will get the head of the trunk | |
370 (if (or (not rev) (string= rev "")) | |
371 "-A" | |
372 (concat "-r" rev)) | |
373 switches))) | |
374 | |
50808
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
375 (defun vc-mcvs-rename-file (old new) |
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
376 (vc-mcvs-command nil 0 new "move" (file-relative-name old))) |
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
377 |
50646 | 378 (defun vc-mcvs-revert (file &optional contents-done) |
379 "Revert FILE to the version it was based on." | |
380 (vc-default-revert file contents-done) | |
381 (unless (eq (vc-checkout-model file) 'implicit) | |
382 (if vc-mcvs-use-edit | |
383 (vc-mcvs-command nil 0 file "unedit") | |
384 ;; Make the file read-only by switching off all w-bits | |
385 (set-file-modes file (logand (file-modes file) 3950))))) | |
386 | |
387 (defun vc-mcvs-merge (file first-version &optional second-version) | |
388 "Merge changes into current working copy of FILE. | |
389 The changes are between FIRST-VERSION and SECOND-VERSION." | |
390 (vc-mcvs-command nil 0 file | |
391 "update" "-kk" | |
392 (concat "-j" first-version) | |
393 (concat "-j" second-version)) | |
394 (vc-file-setprop file 'vc-state 'edited) | |
395 (with-current-buffer (get-buffer "*vc*") | |
396 (goto-char (point-min)) | |
397 (if (re-search-forward "conflicts during merge" nil t) | |
398 1 ; signal error | |
399 0))) ; signal success | |
400 | |
401 (defun vc-mcvs-merge-news (file) | |
402 "Merge in any new changes made to FILE." | |
403 (message "Merging changes into %s..." file) | |
404 ;; (vc-file-setprop file 'vc-workfile-version nil) | |
405 (vc-file-setprop file 'vc-checkout-time 0) | |
406 (vc-mcvs-command nil 0 file "update") | |
407 ;; Analyze the merge result reported by Meta-CVS, and set | |
408 ;; file properties accordingly. | |
409 (with-current-buffer (get-buffer "*vc*") | |
410 (goto-char (point-min)) | |
411 ;; get new workfile version | |
412 (if (re-search-forward | |
413 "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t) | |
414 (vc-file-setprop file 'vc-workfile-version (match-string 1)) | |
415 (vc-file-setprop file 'vc-workfile-version nil)) | |
416 ;; get file status | |
417 (prog1 | |
418 (if (eq (buffer-size) 0) | |
419 0 ;; there were no news; indicate success | |
420 (if (re-search-forward | |
421 (concat "^\\([CMUP] \\)?" | |
422 ".*" | |
423 "\\( already contains the differences between \\)?") | |
424 nil t) | |
425 (cond | |
426 ;; Merge successful, we are in sync with repository now | |
427 ((or (match-string 2) | |
428 (string= (match-string 1) "U ") | |
429 (string= (match-string 1) "P ")) | |
430 (vc-file-setprop file 'vc-state 'up-to-date) | |
431 (vc-file-setprop file 'vc-checkout-time | |
432 (nth 5 (file-attributes file))) | |
433 0);; indicate success to the caller | |
434 ;; Merge successful, but our own changes are still in the file | |
435 ((string= (match-string 1) "M ") | |
436 (vc-file-setprop file 'vc-state 'edited) | |
437 0);; indicate success to the caller | |
438 ;; Conflicts detected! | |
439 (t | |
440 (vc-file-setprop file 'vc-state 'edited) | |
441 1);; signal the error to the caller | |
442 ) | |
443 (pop-to-buffer "*vc*") | |
444 (error "Couldn't analyze mcvs update result"))) | |
445 (message "Merging changes into %s...done" file)))) | |
446 | |
447 ;;; | |
448 ;;; History functions | |
449 ;;; | |
450 | |
451 (defun vc-mcvs-print-log (file) | |
452 "Get change log associated with FILE." | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
453 (let ((default-directory (vc-mcvs-root file))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
454 ;; Run the command from the root dir so that `mcvs filt' returns |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
455 ;; valid relative names. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
456 (vc-mcvs-command |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
457 nil |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
458 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
459 file "log"))) |
50646 | 460 |
461 (defun vc-mcvs-diff (file &optional oldvers newvers) | |
462 "Get a difference report using Meta-CVS between two versions of FILE." | |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
463 (if (string= (vc-workfile-version file) "0") |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
464 ;; This file is added but not yet committed; there is no master file. |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
465 (if (or oldvers newvers) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
466 (error "No revisions of %s exist" file) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
467 ;; We regard this as "changed". |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
468 ;; Diff it against /dev/null. |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
469 ;; Note: this is NOT a "mcvs diff". |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
470 (apply 'vc-do-command "*vc-diff*" |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
471 1 "diff" file |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
472 (append (vc-switches nil 'diff) '("/dev/null"))) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
473 ;; Even if it's empty, it's locally modified. |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
474 1) |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
475 (let* ((async (and (vc-stay-local-p file) (fboundp 'start-process))) |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
476 ;; Run the command from the root dir so that `mcvs filt' returns |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
477 ;; valid relative names. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
478 (default-directory (vc-mcvs-root file)) |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
479 (status |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
480 (apply 'vc-mcvs-command "*vc-diff*" |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
481 (if async 'async 1) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
482 file "diff" |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
483 (and oldvers (concat "-r" oldvers)) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
484 (and newvers (concat "-r" newvers)) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
485 (vc-switches 'MCVS 'diff)))) |
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
486 (if async 1 status)))) ; async diff, pessimistic assumption. |
50646 | 487 |
488 (defun vc-mcvs-diff-tree (dir &optional rev1 rev2) | |
489 "Diff all files at and below DIR." | |
490 (with-current-buffer "*vc-diff*" | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
491 ;; Run the command from the root dir so that `mcvs filt' returns |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
492 ;; valid relative names. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
493 (setq default-directory (vc-mcvs-root dir)) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
494 ;; cvs diff: use a single call for the entire tree |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
495 (let ((coding-system-for-read (or coding-system-for-read 'undecided))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
496 (apply 'vc-mcvs-command "*vc-diff*" 1 dir "diff" |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
497 (and rev1 (concat "-r" rev1)) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
498 (and rev2 (concat "-r" rev2)) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
499 (vc-switches 'MCVS 'diff))))) |
50646 | 500 |
501 (defun vc-mcvs-annotate-command (file buffer &optional version) | |
502 "Execute \"mcvs annotate\" on FILE, inserting the contents in BUFFER. | |
503 Optional arg VERSION is a version to annotate from." | |
504 (vc-mcvs-command | |
505 buffer | |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
506 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) |
50646 | 507 file "annotate" (if version (concat "-r" version)))) |
508 | |
509 (defalias 'vc-mcvs-annotate-current-time 'vc-cvs-annotate-current-time) | |
510 (defalias 'vc-mcvs-annotate-time 'vc-cvs-annotate-time) | |
511 | |
512 ;;; | |
513 ;;; Snapshot system | |
514 ;;; | |
515 | |
516 (defun vc-mcvs-create-snapshot (dir name branchp) | |
517 "Assign to DIR's current version a given NAME. | |
518 If BRANCHP is non-nil, the name is created as a branch (and the current | |
519 workspace is immediately moved to that new branch)." | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
520 (if (not branchp) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
521 (vc-mcvs-command nil 0 dir "tag" "-c" name) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
522 (vc-mcvs-command nil 0 dir "branch" name) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
523 (vc-mcvs-command nil 0 dir "switch" name))) |
50646 | 524 |
525 (defun vc-mcvs-retrieve-snapshot (dir name update) | |
526 "Retrieve a snapshot at and below DIR. | |
527 NAME is the name of the snapshot; if it is empty, do a `cvs update'. | |
528 If UPDATE is non-nil, then update (resynch) any affected buffers." | |
529 (with-current-buffer (get-buffer-create "*vc*") | |
530 (let ((default-directory dir) | |
531 (sticky-tag)) | |
532 (erase-buffer) | |
533 (if (or (not name) (string= name "")) | |
534 (vc-mcvs-command t 0 nil "update") | |
535 (vc-mcvs-command t 0 nil "update" "-r" name) | |
536 (setq sticky-tag name)) | |
537 (when update | |
538 (goto-char (point-min)) | |
539 (while (not (eobp)) | |
540 (if (looking-at "\\([CMUP]\\) \\(.*\\)") | |
541 (let* ((file (expand-file-name (match-string 2) dir)) | |
542 (state (match-string 1)) | |
543 (buffer (find-buffer-visiting file))) | |
544 (when buffer | |
545 (cond | |
546 ((or (string= state "U") | |
547 (string= state "P")) | |
548 (vc-file-setprop file 'vc-state 'up-to-date) | |
549 (vc-file-setprop file 'vc-workfile-version nil) | |
550 (vc-file-setprop file 'vc-checkout-time | |
551 (nth 5 (file-attributes file)))) | |
552 ((or (string= state "M") | |
553 (string= state "C")) | |
554 (vc-file-setprop file 'vc-state 'edited) | |
555 (vc-file-setprop file 'vc-workfile-version nil) | |
556 (vc-file-setprop file 'vc-checkout-time 0))) | |
557 (vc-file-setprop file 'vc-mcvs-sticky-tag sticky-tag) | |
558 (vc-resynch-buffer file t t)))) | |
559 (forward-line 1)))))) | |
560 | |
561 | |
562 ;;; | |
563 ;;; Miscellaneous | |
564 ;;; | |
565 | |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
566 (defalias 'vc-mcvs-make-version-backups-p 'vc-stay-local-p |
50646 | 567 "Return non-nil if version backups should be made for FILE.") |
568 (defalias 'vc-mcvs-check-headers 'vc-cvs-check-headers) | |
569 | |
570 | |
571 ;;; | |
572 ;;; Internal functions | |
573 ;;; | |
574 | |
575 (defun vc-mcvs-command (buffer okstatus file &rest flags) | |
576 "A wrapper around `vc-do-command' for use in vc-mcvs.el. | |
577 The difference to vc-do-command is that this function always invokes `mcvs', | |
578 and that it passes `vc-mcvs-global-switches' to it before FLAGS." | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
579 (let ((args (append '("--error-terminate") |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
580 (if (stringp vc-mcvs-global-switches) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
581 (cons vc-mcvs-global-switches flags) |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
582 (append vc-mcvs-global-switches flags))))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
583 (if (not (member (car flags) '("diff" "log" "status"))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
584 ;; No need to filter: do it the easy way. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
585 (apply 'vc-do-command buffer okstatus "mcvs" file args) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
586 ;; We need to filter the output. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
587 ;; The output of the filter uses filenames relative to the root, |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
588 ;; so we need to change the default-directory. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
589 (assert (equal default-directory (vc-mcvs-root file))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
590 (vc-do-command |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
591 buffer okstatus "sh" nil "-c" |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
592 (concat "mcvs " |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
593 (mapconcat |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
594 'shell-quote-argument |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
595 (append (remq nil args) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
596 (if file (list (file-relative-name file)))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
597 " ") |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
598 " | mcvs filt"))))) |
50646 | 599 |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
600 (defun vc-mcvs-repository-hostname (dirname) |
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
601 (vc-cvs-repository-hostname (vc-mcvs-root dirname))) |
50646 | 602 |
603 (defun vc-mcvs-dir-state-heuristic (dir) | |
604 "Find the Meta-CVS state of all files in DIR, using only local information." | |
605 (with-temp-buffer | |
606 (vc-cvs-get-entries dir) | |
607 (goto-char (point-min)) | |
608 (while (not (eobp)) | |
609 ;; Meta-MCVS-removed files are not taken under VC control. | |
610 (when (looking-at "/\\([^/]*\\)/[^/-]") | |
611 (let ((file (expand-file-name (match-string 1) dir))) | |
612 (unless (vc-file-getprop file 'vc-state) | |
613 (vc-cvs-parse-entry file t)))) | |
614 (forward-line 1)))) | |
615 | |
616 (defalias 'vc-mcvs-valid-symbolic-tag-name-p 'vc-cvs-valid-symbolic-tag-name-p) | |
617 (defalias 'vc-mcvs-valid-version-number-p 'vc-cvs-valid-version-number-p) | |
618 | |
619 (provide 'vc-mcvs) | |
620 ;;; vc-mcvs.el ends here |