Mercurial > emacs
annotate lisp/vc-mcvs.el @ 94612:b37bca16668a
Typo fix.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Sun, 04 May 2008 13:20:50 +0000 |
parents | a0bb8ca25a33 |
children | ee5932bf781d |
rev | line source |
---|---|
50646 | 1 ;;; vc-mcvs.el --- VC backend for the Meta-CVS version-control system |
2 | |
79721 | 3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
50646 | 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 | |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
12 ;; the Free Software Foundation; either version 3, or (at your option) |
50646 | 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 | |
64091 | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02110-1301, USA. | |
50646 | 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 |
57914
4afd8cdfd00e
(vc-mcvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57095
diff
changeset
|
28 ;; |
50779
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 |
57914
4afd8cdfd00e
(vc-mcvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57095
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)) | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
72 :version "22.1" |
50646 | 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)) | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
84 :version "22.1" |
50646 | 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)) | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
94 :version "22.1" |
50646 | 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'." | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
100 :version "22.1" |
50646 | 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 | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
109 :version "22.1" |
50646 | 110 :group 'vc) |
111 | |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
112 ;;; Properties of the backend |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
113 |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94481
diff
changeset
|
114 (defalias 'vc-mcvs-revision-granularity 'vc-cvs-revision-granularity) |
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94481
diff
changeset
|
115 (defalias 'vc-mcvs-checkout-model 'vc-cvs-checkout-model) |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
116 |
50646 | 117 ;;; |
118 ;;; State-querying functions | |
119 ;;; | |
120 | |
121 ;;;###autoload (defun vc-mcvs-registered (file) | |
57095
74d256616e05
(vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55815
diff
changeset
|
122 ;;;###autoload (if (vc-find-root file "MCVS/CVS") |
74d256616e05
(vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55815
diff
changeset
|
123 ;;;###autoload (progn |
74d256616e05
(vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55815
diff
changeset
|
124 ;;;###autoload (load "vc-mcvs") |
74d256616e05
(vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55815
diff
changeset
|
125 ;;;###autoload (vc-mcvs-registered file)))) |
50646 | 126 |
127 (defun vc-mcvs-root (file) | |
128 "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
|
129 (or (vc-file-getprop file 'mcvs-root) |
57095
74d256616e05
(vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55815
diff
changeset
|
130 (vc-file-setprop file 'mcvs-root (vc-find-root file "MCVS/CVS")))) |
50646 | 131 |
132 (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
|
133 (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
|
134 (with-temp-buffer |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
135 (insert-file-contents file) |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
136 (goto-char (point-min)) |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
137 (read (current-buffer))))) |
50646 | 138 |
139 (defun vc-mcvs-map-file (dir file) | |
140 (let ((map (vc-mcvs-read (expand-file-name "MCVS/MAP" dir))) | |
141 inode) | |
142 (dolist (x map inode) | |
143 (if (equal (nth 2 x) file) (setq inode (nth 1 x)))))) | |
144 | |
145 (defun vc-mcvs-registered (file) | |
146 (let (root inode cvsfile) | |
147 (when (and (setq root (vc-mcvs-root file)) | |
148 (setq inode (vc-mcvs-map-file | |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
149 root (file-relative-name file root)))) |
50646 | 150 (vc-file-setprop file 'mcvs-inode inode) |
151 ;; Avoid calling `mcvs diff' in vc-workfile-unchanged-p. | |
152 (vc-file-setprop file 'vc-checkout-time | |
153 (if (vc-cvs-registered | |
154 (setq cvsfile (expand-file-name inode root))) | |
155 (vc-file-getprop cvsfile 'vc-checkout-time) | |
156 ;; The file might not be registered yet because | |
157 ;; of lazy-adding. | |
158 0)) | |
159 t))) | |
160 | |
161 (defun vc-mcvs-state (file) | |
162 ;; This would assume the Meta-CVS sandbox is synchronized. | |
163 ;; (vc-mcvs-cvs state file)) | |
164 "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
|
165 (if (vc-stay-local-p file) |
50646 | 166 (let ((state (vc-file-getprop file 'vc-state))) |
167 ;; If we should stay local, use the heuristic but only if | |
168 ;; we don't have a more precise state already available. | |
169 (if (memq state '(up-to-date edited)) | |
170 (vc-mcvs-state-heuristic file) | |
171 state)) | |
172 (with-temp-buffer | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
173 (setq default-directory (vc-mcvs-root file)) |
50646 | 174 (vc-mcvs-command t 0 file "status") |
175 (vc-cvs-parse-status t)))) | |
176 | |
177 | |
178 (defalias 'vc-mcvs-state-heuristic 'vc-cvs-state-heuristic) | |
179 | |
180 (defun vc-mcvs-dir-state (dir) | |
87424
c0ee02a9ac55
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87139
diff
changeset
|
181 "Find the Meta-CVS state of all files in DIR and subdirectories." |
50646 | 182 ;; if DIR is not under Meta-CVS control, don't do anything. |
183 (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
|
184 (if (vc-stay-local-p dir) |
50646 | 185 (vc-mcvs-dir-state-heuristic dir) |
186 (let ((default-directory dir)) | |
187 ;; Don't specify DIR in this command, the default-directory is | |
188 ;; enough. Otherwise it might fail with remote repositories. | |
189 (with-temp-buffer | |
87442
c5df210848ca
* vc-bzr.el, vc-cvs.el, vc-git.el, vc-hg.el, vc-mcvs.el, vc-svn.el:
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87432
diff
changeset
|
190 (buffer-disable-undo) ;; Because these buffers can get huge |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
191 (setq default-directory (vc-mcvs-root dir)) |
87424
c0ee02a9ac55
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87139
diff
changeset
|
192 (vc-mcvs-command t 0 nil "status") |
50646 | 193 (goto-char (point-min)) |
194 (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) | |
195 (narrow-to-region (match-beginning 0) (match-end 0)) | |
196 (vc-cvs-parse-status) | |
197 (goto-char (point-max)) | |
198 (widen))))))) | |
199 | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
200 (defun vc-mcvs-working-revision (file) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
201 (vc-cvs-working-revision |
53639
ee35e8c06381
(vc-mcvs-mode-line-string): Remove. Does not work.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
202 (expand-file-name (vc-file-getprop file 'mcvs-inode) |
ee35e8c06381
(vc-mcvs-mode-line-string): Remove. Does not work.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
203 (vc-file-getprop file 'mcvs-root)))) |
50646 | 204 |
205 ;;; | |
206 ;;; State-changing functions | |
207 ;;; | |
208 | |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
209 (defun vc-mcvs-register (files &optional rev comment) |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
210 "Register FILES into the Meta-CVS version-control system. |
50646 | 211 COMMENT can be used to provide an initial description of FILE. |
212 | |
213 `vc-register-switches' and `vc-mcvs-register-switches' are passed to | |
214 the Meta-CVS command (in that order)." | |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
215 ;; FIXME: multiple-file case should be made to work |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
216 (if (> (length files) 1) (error "Registering filesets is not yet supported.")) |
92161
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
217 (let* ((file (car files)) |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
218 (filename (file-name-nondirectory file)) |
50646 | 219 (extpos (string-match "\\." filename)) |
220 (ext (if extpos (substring filename (1+ extpos)))) | |
221 (root (vc-mcvs-root file)) | |
222 (types-file (expand-file-name "MCVS/TYPES" root)) | |
223 (map-file (expand-file-name "MCVS/MAP" root)) | |
224 (types (vc-mcvs-read types-file))) | |
225 ;; Make sure meta files like MCVS/MAP are not read-only (happens with | |
226 ;; CVSREAD) since Meta-CVS doesn't pay attention to it at all and goes | |
227 ;; belly-up. | |
228 (unless (file-writable-p map-file) | |
229 (vc-checkout map-file t)) | |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
230 (unless (or (file-writable-p types-file) (not (file-exists-p types-file))) |
50646 | 231 (vc-checkout types-file t)) |
232 ;; Make sure the `mcvs add' will not fire up the CVSEDITOR | |
233 ;; to add a rule for the given file's extension. | |
234 (when (and ext (not (assoc ext types))) | |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
64762
diff
changeset
|
235 (let ((type (completing-read "Type to use (default): " |
50646 | 236 '("default" "name-only" "keep-old" |
237 "binary" "value-only") | |
238 nil t nil nil "default"))) | |
239 (push (list ext (make-symbol (upcase (concat ":" type)))) types) | |
240 (setq types (sort types (lambda (x y) (string< (car x) (car y))))) | |
241 (with-current-buffer (find-file-noselect types-file) | |
242 (erase-buffer) | |
243 (pp types (current-buffer)) | |
244 (save-buffer) | |
245 (unless (get-buffer-window (current-buffer) t) | |
92161
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
246 (kill-buffer (current-buffer)))))) |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
247 ;; Now do the ADD. |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
248 (prog1 (apply 'vc-mcvs-command nil 0 file |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
249 "add" |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
250 (and comment (string-match "[^\t\n ]" comment) |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
251 (concat "-m" comment)) |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
252 (vc-switches 'MCVS 'register)) |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
253 ;; I'm not sure exactly why, but if we don't setup the inode and root |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
254 ;; prop of the file, things break later on in vc-mode-line that |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
255 ;; ends up calling vc-mcvs-working-revision. |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
256 ;; We also need to set vc-checkout-time so that vc-workfile-unchanged-p |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
257 ;; doesn't try to call `mcvs diff' on the file. |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
258 (vc-mcvs-registered file)))) |
50646 | 259 |
260 (defalias 'vc-mcvs-responsible-p 'vc-mcvs-root | |
261 "Return non-nil if CVS thinks it is responsible for FILE.") | |
262 | |
263 (defalias 'vc-cvs-could-register 'vc-cvs-responsible-p | |
264 "Return non-nil if FILE could be registered in Meta-CVS. | |
265 This is only possible if Meta-CVS is responsible for FILE's directory.") | |
266 | |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
267 (defun vc-mcvs-checkin (files rev comment) |
50646 | 268 "Meta-CVS-specific version of `vc-backend-checkin'." |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
269 (unless (or (not rev) (vc-mcvs-valid-revision-number-p rev)) |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
270 (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
|
271 (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
|
272 ;; 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
|
273 ;; 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
|
274 ;; 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
|
275 ;; 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
|
276 ;; be applied just to this one file. |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
277 (apply 'vc-mcvs-command nil 0 files "tag" "-b" (list rev)) |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
278 (apply 'vc-mcvs-command nil 0 files "update" "-r" (list rev)) |
85184
025303f3b74d
(vc-mcvs-checkin): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
85141
diff
changeset
|
279 (mapc (lambda (file) (vc-file-setprop file 'vc-mcvs-sticky-tag rev)) |
025303f3b74d
(vc-mcvs-checkin): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
85141
diff
changeset
|
280 files) |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
281 (setq rev nil))) |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
282 ;; 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
|
283 ;; 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
|
284 (when rev (error "Cannot commit to a specific revision number")) |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
285 (let ((status (apply 'vc-mcvs-command nil 1 files |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
286 "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
|
287 (vc-switches 'MCVS 'checkin)))) |
50646 | 288 (set-buffer "*vc*") |
289 (goto-char (point-min)) | |
290 (when (not (zerop status)) | |
291 ;; Check checkin problem. | |
292 (cond | |
293 ((re-search-forward "Up-to-date check failed" nil t) | |
85184
025303f3b74d
(vc-mcvs-checkin): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
85141
diff
changeset
|
294 (mapc (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge)) |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
295 files) |
87139
f358a2fd5895
Fix buggy calls to `error'.
Deepak Goel <deego@gnufans.org>
parents:
86002
diff
changeset
|
296 (error "%s" (substitute-command-keys |
50646 | 297 (concat "Up-to-date check failed: " |
298 "type \\[vc-next-action] to merge in changes")))) | |
299 (t | |
300 (pop-to-buffer (current-buffer)) | |
301 (goto-char (point-min)) | |
302 (shrink-window-if-larger-than-buffer) | |
303 (error "Check-in failed")))) | |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
304 ;; Single-file commit? Then update the revision by parsing the buffer. |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
305 ;; Otherwise we can't necessarily tell what goes with what; clear |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
306 ;; its properties so they have to be refetched. |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
307 (if (= (length files) 1) |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
308 (vc-file-setprop |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
309 (car files) 'vc-working-revision |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
310 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
311 (mapc (lambda (file) (vc-file-clearprops file)) files)) |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
312 ;; Anyway, forget the checkout model of the file, because we might have |
50646 | 313 ;; guessed wrong when we found the file. After commit, we can |
314 ;; tell it from the permissions of the file (see | |
315 ;; vc-mcvs-checkout-model). | |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
316 (mapc (lambda (file) (vc-file-setprop file 'vc-checkout-model nil)) |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
317 files) |
50646 | 318 |
319 ;; if this was an explicit check-in (does not include creation of | |
320 ;; a branch), remove the sticky tag. | |
321 (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev))) | |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
322 (vc-mcvs-command nil 0 files "update" "-A")))) |
50646 | 323 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
324 (defun vc-mcvs-find-revision (file rev buffer) |
50646 | 325 (apply 'vc-mcvs-command |
326 buffer 0 file | |
327 "-Q" ; suppress diagnostic output | |
328 "update" | |
329 (and rev (not (string= rev "")) | |
330 (concat "-r" rev)) | |
331 "-p" | |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
332 (vc-switches 'MCVS 'checkout))) |
50646 | 333 |
334 (defun vc-mcvs-checkout (file &optional editable rev) | |
335 (message "Checking out %s..." file) | |
336 (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
|
337 (vc-call update file editable rev (vc-switches 'MCVS 'checkout))) |
50646 | 338 (vc-mode-line file) |
339 (message "Checking out %s...done" file)) | |
340 | |
341 (defun vc-mcvs-update (file editable rev switches) | |
342 (if (and (file-exists-p file) (not rev)) | |
343 ;; If no revision was specified, just make the file writable | |
344 ;; if necessary (using `cvs-edit' if requested). | |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94481
diff
changeset
|
345 (and editable (not (eq (vc-mcvs-checkout-model (list file)) 'implicit)) |
50646 | 346 (if vc-mcvs-use-edit |
347 (vc-mcvs-command nil 0 file "edit") | |
348 (set-file-modes file (logior (file-modes file) 128)) | |
349 (if (equal file buffer-file-name) (toggle-read-only -1)))) | |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
350 ;; Check out a particular revision (or recreate the file). |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
351 (vc-file-setprop file 'vc-working-revision nil) |
50646 | 352 (apply 'vc-mcvs-command nil 0 file |
353 (if editable "-w") | |
354 "update" | |
355 ;; default for verbose checkout: clear the sticky tag so | |
356 ;; that the actual update will get the head of the trunk | |
357 (if (or (not rev) (string= rev "")) | |
358 "-A" | |
359 (concat "-r" rev)) | |
360 switches))) | |
361 | |
50808
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
362 (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
|
363 (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
|
364 |
50646 | 365 (defun vc-mcvs-revert (file &optional contents-done) |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
366 "Revert FILE to the working revision it was based on." |
67573
123d22825421
(vc-mcvs-revert): Fix call to vc-default-revert.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65680
diff
changeset
|
367 (vc-default-revert 'MCVS file contents-done) |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94481
diff
changeset
|
368 (unless (eq (vc-mcvs-checkout-model (list file)) 'implicit) |
50646 | 369 (if vc-mcvs-use-edit |
370 (vc-mcvs-command nil 0 file "unedit") | |
371 ;; Make the file read-only by switching off all w-bits | |
372 (set-file-modes file (logand (file-modes file) 3950))))) | |
373 | |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
374 (defun vc-mcvs-merge (file first-revision &optional second-revision) |
50646 | 375 "Merge changes into current working copy of FILE. |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
376 The changes are between FIRST-REVISION and SECOND-REVISION." |
50646 | 377 (vc-mcvs-command nil 0 file |
378 "update" "-kk" | |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
379 (concat "-j" first-revision) |
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
380 (concat "-j" second-revision)) |
50646 | 381 (vc-file-setprop file 'vc-state 'edited) |
382 (with-current-buffer (get-buffer "*vc*") | |
383 (goto-char (point-min)) | |
384 (if (re-search-forward "conflicts during merge" nil t) | |
385 1 ; signal error | |
386 0))) ; signal success | |
387 | |
388 (defun vc-mcvs-merge-news (file) | |
389 "Merge in any new changes made to FILE." | |
390 (message "Merging changes into %s..." file) | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
391 ;; (vc-file-setprop file 'vc-working-revision nil) |
50646 | 392 (vc-file-setprop file 'vc-checkout-time 0) |
393 (vc-mcvs-command nil 0 file "update") | |
394 ;; Analyze the merge result reported by Meta-CVS, and set | |
395 ;; file properties accordingly. | |
396 (with-current-buffer (get-buffer "*vc*") | |
397 (goto-char (point-min)) | |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
398 ;; get new working revision |
50646 | 399 (if (re-search-forward |
400 "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t) | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
401 (vc-file-setprop file 'vc-working-revision (match-string 1)) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
402 (vc-file-setprop file 'vc-working-revision nil)) |
50646 | 403 ;; get file status |
404 (prog1 | |
405 (if (eq (buffer-size) 0) | |
406 0 ;; there were no news; indicate success | |
407 (if (re-search-forward | |
408 (concat "^\\([CMUP] \\)?" | |
409 ".*" | |
410 "\\( already contains the differences between \\)?") | |
411 nil t) | |
412 (cond | |
413 ;; Merge successful, we are in sync with repository now | |
414 ((or (match-string 2) | |
415 (string= (match-string 1) "U ") | |
416 (string= (match-string 1) "P ")) | |
417 (vc-file-setprop file 'vc-state 'up-to-date) | |
418 (vc-file-setprop file 'vc-checkout-time | |
419 (nth 5 (file-attributes file))) | |
420 0);; indicate success to the caller | |
421 ;; Merge successful, but our own changes are still in the file | |
422 ((string= (match-string 1) "M ") | |
423 (vc-file-setprop file 'vc-state 'edited) | |
424 0);; indicate success to the caller | |
425 ;; Conflicts detected! | |
426 (t | |
427 (vc-file-setprop file 'vc-state 'edited) | |
428 1);; signal the error to the caller | |
429 ) | |
430 (pop-to-buffer "*vc*") | |
431 (error "Couldn't analyze mcvs update result"))) | |
432 (message "Merging changes into %s...done" file)))) | |
433 | |
87432
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
434 (defun vc-mcvs-modify-change-comment (files rev comment) |
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
435 "Modify the change comments for FILES on a specified REV. |
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
436 Will fail unless you have administrative privileges on the repo." |
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
437 (vc-mcvs-command nil 0 files "rcs" (concat "-m" comment ":" rev))) |
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
438 |
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
439 |
50646 | 440 ;;; |
441 ;;; History functions | |
442 ;;; | |
443 | |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
444 (defun vc-mcvs-print-log (files &optional buffer) |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
445 "Get change log associated with FILES." |
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
446 (let ((default-directory (vc-mcvs-root (car files)))) |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
447 ;; 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
|
448 ;; valid relative names. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
449 (vc-mcvs-command |
55815
a6b86fce5676
(vc-mcvs-print-log, vc-mcvs-diff): Add optional `buffer' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53639
diff
changeset
|
450 buffer |
86002
613df1ba1584
* vc.el (vc-diff-internal): Make the *vc-diff* buffer read only.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85462
diff
changeset
|
451 (if (vc-stay-local-p files) 'async 0) |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
452 files "log"))) |
50646 | 453 |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
454 (defun vc-mcvs-diff (files &optional oldvers newvers buffer) |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
455 "Get a difference report using Meta-CVS between two revisions of FILES." |
59445
73a45ff77795
(vc-mcvs-diff): Don't diff asynchronously if vc-disable-async-diff is
André Spiegel <spiegel@gnu.org>
parents:
57914
diff
changeset
|
456 (let* ((async (and (not vc-disable-async-diff) |
86002
613df1ba1584
* vc.el (vc-diff-internal): Make the *vc-diff* buffer read only.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85462
diff
changeset
|
457 (vc-stay-local-p files))) |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
458 ;; 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
|
459 ;; valid relative names. |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
460 (default-directory (vc-mcvs-root (car files))) |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
461 (status |
55815
a6b86fce5676
(vc-mcvs-print-log, vc-mcvs-diff): Add optional `buffer' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53639
diff
changeset
|
462 (apply 'vc-mcvs-command (or buffer "*vc-diff*") |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
463 (if async 'async 1) |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
464 files "diff" |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
465 (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
|
466 (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
|
467 (vc-switches 'MCVS 'diff)))) |
81965
88498b7a5bb5
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
468 (if async 1 status))) ; async diff, pessimistic assumption. |
50646 | 469 |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
470 (defun vc-mcvs-annotate-command (file buffer &optional revision) |
50646 | 471 "Execute \"mcvs annotate\" on FILE, inserting the contents in BUFFER. |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
472 Optional arg REVISION is a revision to annotate from." |
50646 | 473 (vc-mcvs-command |
474 buffer | |
86002
613df1ba1584
* vc.el (vc-diff-internal): Make the *vc-diff* buffer read only.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85462
diff
changeset
|
475 (if (vc-stay-local-p file) 'async 0) |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
476 file "annotate" (if revision (concat "-r" revision))) |
57914
4afd8cdfd00e
(vc-mcvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57095
diff
changeset
|
477 (with-current-buffer buffer |
4afd8cdfd00e
(vc-mcvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57095
diff
changeset
|
478 (goto-char (point-min)) |
4afd8cdfd00e
(vc-mcvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57095
diff
changeset
|
479 (re-search-forward "^[0-9]") |
4afd8cdfd00e
(vc-mcvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57095
diff
changeset
|
480 (delete-region (point-min) (1- (point))))) |
50646 | 481 |
482 (defalias 'vc-mcvs-annotate-current-time 'vc-cvs-annotate-current-time) | |
483 (defalias 'vc-mcvs-annotate-time 'vc-cvs-annotate-time) | |
484 | |
485 ;;; | |
486 ;;; Snapshot system | |
487 ;;; | |
488 | |
489 (defun vc-mcvs-create-snapshot (dir name branchp) | |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
490 "Assign to DIR's current revision a given NAME. |
50646 | 491 If BRANCHP is non-nil, the name is created as a branch (and the current |
492 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
|
493 (if (not branchp) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
494 (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
|
495 (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
|
496 (vc-mcvs-command nil 0 dir "switch" name))) |
50646 | 497 |
498 (defun vc-mcvs-retrieve-snapshot (dir name update) | |
499 "Retrieve a snapshot at and below DIR. | |
500 NAME is the name of the snapshot; if it is empty, do a `cvs update'. | |
501 If UPDATE is non-nil, then update (resynch) any affected buffers." | |
502 (with-current-buffer (get-buffer-create "*vc*") | |
503 (let ((default-directory dir) | |
504 (sticky-tag)) | |
505 (erase-buffer) | |
506 (if (or (not name) (string= name "")) | |
507 (vc-mcvs-command t 0 nil "update") | |
508 (vc-mcvs-command t 0 nil "update" "-r" name) | |
509 (setq sticky-tag name)) | |
510 (when update | |
511 (goto-char (point-min)) | |
512 (while (not (eobp)) | |
513 (if (looking-at "\\([CMUP]\\) \\(.*\\)") | |
514 (let* ((file (expand-file-name (match-string 2) dir)) | |
515 (state (match-string 1)) | |
516 (buffer (find-buffer-visiting file))) | |
517 (when buffer | |
518 (cond | |
519 ((or (string= state "U") | |
520 (string= state "P")) | |
521 (vc-file-setprop file 'vc-state 'up-to-date) | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
522 (vc-file-setprop file 'vc-working-revision nil) |
50646 | 523 (vc-file-setprop file 'vc-checkout-time |
524 (nth 5 (file-attributes file)))) | |
525 ((or (string= state "M") | |
526 (string= state "C")) | |
527 (vc-file-setprop file 'vc-state 'edited) | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
528 (vc-file-setprop file 'vc-working-revision nil) |
50646 | 529 (vc-file-setprop file 'vc-checkout-time 0))) |
530 (vc-file-setprop file 'vc-mcvs-sticky-tag sticky-tag) | |
531 (vc-resynch-buffer file t t)))) | |
532 (forward-line 1)))))) | |
533 | |
534 | |
535 ;;; | |
536 ;;; Miscellaneous | |
537 ;;; | |
538 | |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
539 (defalias 'vc-mcvs-make-version-backups-p 'vc-stay-local-p |
50646 | 540 "Return non-nil if version backups should be made for FILE.") |
541 (defalias 'vc-mcvs-check-headers 'vc-cvs-check-headers) | |
542 | |
543 | |
544 ;;; | |
545 ;;; Internal functions | |
546 ;;; | |
547 | |
548 (defun vc-mcvs-command (buffer okstatus file &rest flags) | |
549 "A wrapper around `vc-do-command' for use in vc-mcvs.el. | |
550 The difference to vc-do-command is that this function always invokes `mcvs', | |
551 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
|
552 (let ((args (append '("--error-terminate") |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
553 (if (stringp vc-mcvs-global-switches) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
554 (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
|
555 (append vc-mcvs-global-switches flags))))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
556 (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
|
557 ;; 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
|
558 (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
|
559 ;; We need to filter the output. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
560 ;; 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
|
561 ;; so we need to change the default-directory. |
53639
ee35e8c06381
(vc-mcvs-mode-line-string): Remove. Does not work.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
562 ;; (assert (equal default-directory (vc-mcvs-root file))) |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
563 (vc-do-command |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
564 buffer okstatus "sh" nil "-c" |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
565 (concat "mcvs " |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
566 (mapconcat |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
567 'shell-quote-argument |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
568 (append (remq nil args) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
569 (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
|
570 " ") |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
571 " | mcvs filt"))))) |
50646 | 572 |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
573 (defun vc-mcvs-repository-hostname (dirname) |
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
574 (vc-cvs-repository-hostname (vc-mcvs-root dirname))) |
50646 | 575 |
576 (defun vc-mcvs-dir-state-heuristic (dir) | |
577 "Find the Meta-CVS state of all files in DIR, using only local information." | |
578 (with-temp-buffer | |
579 (vc-cvs-get-entries dir) | |
580 (goto-char (point-min)) | |
581 (while (not (eobp)) | |
582 ;; Meta-MCVS-removed files are not taken under VC control. | |
583 (when (looking-at "/\\([^/]*\\)/[^/-]") | |
584 (let ((file (expand-file-name (match-string 1) dir))) | |
585 (unless (vc-file-getprop file 'vc-state) | |
586 (vc-cvs-parse-entry file t)))) | |
587 (forward-line 1)))) | |
588 | |
589 (defalias 'vc-mcvs-valid-symbolic-tag-name-p 'vc-cvs-valid-symbolic-tag-name-p) | |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
590 (defalias 'vc-mcvs-valid-revision-number-p 'vc-cvs-valid-revision-number-p) |
50646 | 591 |
592 (provide 'vc-mcvs) | |
52401 | 593 |
57095
74d256616e05
(vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55815
diff
changeset
|
594 ;; arch-tag: a39c7c1c-5247-429d-88df-dd7187d2e704 |
50646 | 595 ;;; vc-mcvs.el ends here |