Mercurial > emacs
annotate lisp/vc-mcvs.el @ 97688:fea1fc8fb2e8
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 24 Aug 2008 19:06:36 +0000 |
parents | 4da572dc4992 |
children | d42aff5ca541 |
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) | |
94730
3bbff46b7130
Meta-CVS support removed.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94729
diff
changeset
|
6 ;; Maintainer: None |
50646 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
50646 | 11 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
13 ;; (at your option) any later version. |
50646 | 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 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
50646 | 22 |
23 ;;; Commentary: | |
24 | |
50779
02455099d549
Add a link to Meta-CVS home page.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50667
diff
changeset
|
25 ;; 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
|
26 ;; |
50779
02455099d549
Add a link to Meta-CVS home page.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50667
diff
changeset
|
27 ;; 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
|
28 ;; |
50646 | 29 ;; This is derived from vc-cvs.el as follows: |
30 ;; - cp vc-cvs.el vc-mcvs.el | |
31 ;; - Replace CVS/ with MCVS/CVS/ | |
32 ;; - Replace 'CVS with 'MCVS | |
33 ;; - Replace -cvs- with -mcvs- | |
34 ;; - Replace most of the rest of CVS to Meta-CVS | |
35 ;; | |
36 ;; Then of course started the hacking. Only a small part of the code | |
37 ;; has been touched and not much more than that was tested, so if | |
38 ;; you bump into a bug, don't be surprised: just report it to me. | |
39 ;; | |
40 ;; What has been partly tested: | |
41 ;; - C-x v v to start editing a file that was checked out with CVSREAD on. | |
42 ;; - C-x v v to commit a file | |
43 ;; - C-x v = | |
44 ;; - C-x v l | |
45 ;; - C-x v i | |
46 ;; - C-x v g | |
50808
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
47 ;; - M-x vc-rename-file RET |
50646 | 48 |
49 ;;; Bugs: | |
50 | |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
51 ;; - Retrieving tags doesn't filter `cvs update' output and thus |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
52 ;; parses bogus filenames. Don't know if it harms. |
50646 | 53 |
54 ;;; Code: | |
55 | |
56 (eval-when-compile (require 'vc)) | |
57 (require 'vc-cvs) | |
58 | |
59 ;;; | |
60 ;;; Customization options | |
61 ;;; | |
62 | |
63 (defcustom vc-mcvs-global-switches nil | |
64 "*Global switches to pass to any Meta-CVS command." | |
65 :type '(choice (const :tag "None" nil) | |
66 (string :tag "Argument String") | |
67 (repeat :tag "Argument List" | |
68 :value ("") | |
69 string)) | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
70 :version "22.1" |
50646 | 71 :group 'vc) |
72 | |
73 (defcustom vc-mcvs-register-switches nil | |
74 "*Extra switches for registering a file into Meta-CVS. | |
75 A string or list of strings passed to the checkin program by | |
76 \\[vc-register]." | |
77 :type '(choice (const :tag "None" nil) | |
78 (string :tag "Argument String") | |
79 (repeat :tag "Argument List" | |
80 :value ("") | |
81 string)) | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
82 :version "22.1" |
50646 | 83 :group 'vc) |
84 | |
85 (defcustom vc-mcvs-diff-switches nil | |
86 "*A string or list of strings specifying extra switches for cvs diff under VC." | |
87 :type '(choice (const :tag "None" nil) | |
88 (string :tag "Argument String") | |
89 (repeat :tag "Argument List" | |
90 :value ("") | |
91 string)) | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
92 :version "22.1" |
50646 | 93 :group 'vc) |
94 | |
95 (defcustom vc-mcvs-header (or (cdr (assoc 'MCVS vc-header-alist)) | |
96 vc-cvs-header) | |
97 "*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
|
98 :version "22.1" |
50646 | 99 :type '(repeat string) |
100 :group 'vc) | |
101 | |
102 (defcustom vc-mcvs-use-edit vc-cvs-use-edit | |
103 "*Non-nil means to use `cvs edit' to \"check out\" a file. | |
104 This is only meaningful if you don't use the implicit checkout model | |
105 \(i.e. if you have $CVSREAD set)." | |
106 :type 'boolean | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59445
diff
changeset
|
107 :version "22.1" |
50646 | 108 :group 'vc) |
109 | |
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
|
110 ;;; 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
|
111 |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94481
diff
changeset
|
112 (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
|
113 (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
|
114 |
50646 | 115 ;;; |
116 ;;; State-querying functions | |
117 ;;; | |
118 | |
119 ;;;###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
|
120 ;;;###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
|
121 ;;;###autoload (progn |
74d256616e05
(vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55815
diff
changeset
|
122 ;;;###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
|
123 ;;;###autoload (vc-mcvs-registered file)))) |
50646 | 124 |
125 (defun vc-mcvs-root (file) | |
126 "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
|
127 (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
|
128 (vc-file-setprop file 'mcvs-root (vc-find-root file "MCVS/CVS")))) |
50646 | 129 |
130 (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
|
131 (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
|
132 (with-temp-buffer |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
133 (insert-file-contents file) |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
134 (goto-char (point-min)) |
6b9cefee3eee
(vc-mcvs-read): Don't require `file' to exist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50808
diff
changeset
|
135 (read (current-buffer))))) |
50646 | 136 |
137 (defun vc-mcvs-map-file (dir file) | |
138 (let ((map (vc-mcvs-read (expand-file-name "MCVS/MAP" dir))) | |
139 inode) | |
140 (dolist (x map inode) | |
141 (if (equal (nth 2 x) file) (setq inode (nth 1 x)))))) | |
142 | |
143 (defun vc-mcvs-registered (file) | |
144 (let (root inode cvsfile) | |
145 (when (and (setq root (vc-mcvs-root file)) | |
146 (setq inode (vc-mcvs-map-file | |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
147 root (file-relative-name file root)))) |
50646 | 148 (vc-file-setprop file 'mcvs-inode inode) |
149 ;; Avoid calling `mcvs diff' in vc-workfile-unchanged-p. | |
150 (vc-file-setprop file 'vc-checkout-time | |
151 (if (vc-cvs-registered | |
152 (setq cvsfile (expand-file-name inode root))) | |
153 (vc-file-getprop cvsfile 'vc-checkout-time) | |
154 ;; The file might not be registered yet because | |
155 ;; of lazy-adding. | |
156 0)) | |
157 t))) | |
158 | |
159 (defun vc-mcvs-state (file) | |
160 ;; This would assume the Meta-CVS sandbox is synchronized. | |
161 ;; (vc-mcvs-cvs state file)) | |
162 "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
|
163 (if (vc-stay-local-p file) |
50646 | 164 (let ((state (vc-file-getprop file 'vc-state))) |
165 ;; If we should stay local, use the heuristic but only if | |
166 ;; we don't have a more precise state already available. | |
167 (if (memq state '(up-to-date edited)) | |
168 (vc-mcvs-state-heuristic file) | |
169 state)) | |
170 (with-temp-buffer | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
171 (setq default-directory (vc-mcvs-root file)) |
50646 | 172 (vc-mcvs-command t 0 file "status") |
173 (vc-cvs-parse-status t)))) | |
174 | |
175 | |
176 (defalias 'vc-mcvs-state-heuristic 'vc-cvs-state-heuristic) | |
177 | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
178 (defun vc-mcvs-working-revision (file) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
179 (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
|
180 (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
|
181 (vc-file-getprop file 'mcvs-root)))) |
50646 | 182 |
183 ;;; | |
184 ;;; State-changing functions | |
185 ;;; | |
186 | |
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
|
187 (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
|
188 "Register FILES into the Meta-CVS version-control system. |
50646 | 189 COMMENT can be used to provide an initial description of FILE. |
190 | |
191 `vc-register-switches' and `vc-mcvs-register-switches' are passed to | |
192 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
|
193 ;; 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
|
194 (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
|
195 (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
|
196 (filename (file-name-nondirectory file)) |
50646 | 197 (extpos (string-match "\\." filename)) |
198 (ext (if extpos (substring filename (1+ extpos)))) | |
199 (root (vc-mcvs-root file)) | |
200 (types-file (expand-file-name "MCVS/TYPES" root)) | |
201 (map-file (expand-file-name "MCVS/MAP" root)) | |
202 (types (vc-mcvs-read types-file))) | |
203 ;; Make sure meta files like MCVS/MAP are not read-only (happens with | |
204 ;; CVSREAD) since Meta-CVS doesn't pay attention to it at all and goes | |
205 ;; belly-up. | |
206 (unless (file-writable-p map-file) | |
207 (vc-checkout map-file t)) | |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
208 (unless (or (file-writable-p types-file) (not (file-exists-p types-file))) |
50646 | 209 (vc-checkout types-file t)) |
210 ;; Make sure the `mcvs add' will not fire up the CVSEDITOR | |
211 ;; to add a rule for the given file's extension. | |
212 (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
|
213 (let ((type (completing-read "Type to use (default): " |
50646 | 214 '("default" "name-only" "keep-old" |
215 "binary" "value-only") | |
216 nil t nil nil "default"))) | |
217 (push (list ext (make-symbol (upcase (concat ":" type)))) types) | |
218 (setq types (sort types (lambda (x y) (string< (car x) (car y))))) | |
219 (with-current-buffer (find-file-noselect types-file) | |
220 (erase-buffer) | |
221 (pp types (current-buffer)) | |
222 (save-buffer) | |
223 (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
|
224 (kill-buffer (current-buffer)))))) |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
225 ;; Now do the ADD. |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
226 (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
|
227 "add" |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
228 (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
|
229 (concat "-m" comment)) |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
230 (vc-switches 'MCVS 'register)) |
4be0bf41fa98
(vc-mcvs-register): Fix let-binding (for use of `file').
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
231 ;; 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
|
232 ;; 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
|
233 ;; 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
|
234 ;; 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
|
235 ;; 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
|
236 (vc-mcvs-registered file)))) |
50646 | 237 |
238 (defalias 'vc-mcvs-responsible-p 'vc-mcvs-root | |
239 "Return non-nil if CVS thinks it is responsible for FILE.") | |
240 | |
241 (defalias 'vc-cvs-could-register 'vc-cvs-responsible-p | |
242 "Return non-nil if FILE could be registered in Meta-CVS. | |
243 This is only possible if Meta-CVS is responsible for FILE's directory.") | |
244 | |
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
|
245 (defun vc-mcvs-checkin (files rev comment) |
50646 | 246 "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
|
247 (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
|
248 (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
|
249 (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
|
250 ;; 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
|
251 ;; 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
|
252 ;; 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
|
253 ;; 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
|
254 ;; 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
|
255 (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
|
256 (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
|
257 (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
|
258 files) |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
259 (setq rev nil))) |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
260 ;; 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
|
261 ;; 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
|
262 (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
|
263 (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
|
264 "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
|
265 (vc-switches 'MCVS 'checkin)))) |
50646 | 266 (set-buffer "*vc*") |
267 (goto-char (point-min)) | |
268 (when (not (zerop status)) | |
269 ;; Check checkin problem. | |
270 (cond | |
271 ((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
|
272 (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
|
273 files) |
87139
f358a2fd5895
Fix buggy calls to `error'.
Deepak Goel <deego@gnufans.org>
parents:
86002
diff
changeset
|
274 (error "%s" (substitute-command-keys |
50646 | 275 (concat "Up-to-date check failed: " |
276 "type \\[vc-next-action] to merge in changes")))) | |
277 (t | |
278 (pop-to-buffer (current-buffer)) | |
279 (goto-char (point-min)) | |
280 (shrink-window-if-larger-than-buffer) | |
281 (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
|
282 ;; 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
|
283 ;; 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
|
284 ;; 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
|
285 (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
|
286 (vc-file-setprop |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
287 (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
|
288 (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
|
289 (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
|
290 ;; Anyway, forget the checkout model of the file, because we might have |
50646 | 291 ;; guessed wrong when we found the file. After commit, we can |
292 ;; tell it from the permissions of the file (see | |
293 ;; 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
|
294 (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
|
295 files) |
50646 | 296 |
297 ;; if this was an explicit check-in (does not include creation of | |
298 ;; a branch), remove the sticky tag. | |
299 (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
|
300 (vc-mcvs-command nil 0 files "update" "-A")))) |
50646 | 301 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
302 (defun vc-mcvs-find-revision (file rev buffer) |
50646 | 303 (apply 'vc-mcvs-command |
304 buffer 0 file | |
305 "-Q" ; suppress diagnostic output | |
306 "update" | |
307 (and rev (not (string= rev "")) | |
308 (concat "-r" rev)) | |
309 "-p" | |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
310 (vc-switches 'MCVS 'checkout))) |
50646 | 311 |
312 (defun vc-mcvs-checkout (file &optional editable rev) | |
313 (message "Checking out %s..." file) | |
314 (with-current-buffer (or (get-file-buffer file) (current-buffer)) | |
94805
89d37b54b964
* vc.el (vc-mark-resolved): Add `backend' argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94730
diff
changeset
|
315 (vc-mcvs-update file editable rev (vc-switches 'MCVS 'checkout))) |
50646 | 316 (vc-mode-line file) |
317 (message "Checking out %s...done" file)) | |
318 | |
319 (defun vc-mcvs-update (file editable rev switches) | |
320 (if (and (file-exists-p file) (not rev)) | |
321 ;; If no revision was specified, just make the file writable | |
322 ;; 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
|
323 (and editable (not (eq (vc-mcvs-checkout-model (list file)) 'implicit)) |
50646 | 324 (if vc-mcvs-use-edit |
325 (vc-mcvs-command nil 0 file "edit") | |
326 (set-file-modes file (logior (file-modes file) 128)) | |
327 (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
|
328 ;; Check out a particular revision (or recreate the file). |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
329 (vc-file-setprop file 'vc-working-revision nil) |
50646 | 330 (apply 'vc-mcvs-command nil 0 file |
331 (if editable "-w") | |
332 "update" | |
333 ;; default for verbose checkout: clear the sticky tag so | |
334 ;; that the actual update will get the head of the trunk | |
335 (if (or (not rev) (string= rev "")) | |
336 "-A" | |
337 (concat "-r" rev)) | |
338 switches))) | |
339 | |
50808
5a0d0a9219f3
(vc-mcvs-mode-line-string): Fix thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50779
diff
changeset
|
340 (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
|
341 (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
|
342 |
50646 | 343 (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
|
344 "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
|
345 (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
|
346 (unless (eq (vc-mcvs-checkout-model (list file)) 'implicit) |
50646 | 347 (if vc-mcvs-use-edit |
348 (vc-mcvs-command nil 0 file "unedit") | |
349 ;; Make the file read-only by switching off all w-bits | |
350 (set-file-modes file (logand (file-modes file) 3950))))) | |
351 | |
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
|
352 (defun vc-mcvs-merge (file first-revision &optional second-revision) |
50646 | 353 "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
|
354 The changes are between FIRST-REVISION and SECOND-REVISION." |
50646 | 355 (vc-mcvs-command nil 0 file |
356 "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
|
357 (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
|
358 (concat "-j" second-revision)) |
50646 | 359 (vc-file-setprop file 'vc-state 'edited) |
360 (with-current-buffer (get-buffer "*vc*") | |
361 (goto-char (point-min)) | |
362 (if (re-search-forward "conflicts during merge" nil t) | |
363 1 ; signal error | |
364 0))) ; signal success | |
365 | |
366 (defun vc-mcvs-merge-news (file) | |
367 "Merge in any new changes made to FILE." | |
368 (message "Merging changes into %s..." file) | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
369 ;; (vc-file-setprop file 'vc-working-revision nil) |
50646 | 370 (vc-file-setprop file 'vc-checkout-time 0) |
371 (vc-mcvs-command nil 0 file "update") | |
372 ;; Analyze the merge result reported by Meta-CVS, and set | |
373 ;; file properties accordingly. | |
374 (with-current-buffer (get-buffer "*vc*") | |
375 (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
|
376 ;; get new working revision |
50646 | 377 (if (re-search-forward |
378 "^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
|
379 (vc-file-setprop file 'vc-working-revision (match-string 1)) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
380 (vc-file-setprop file 'vc-working-revision nil)) |
50646 | 381 ;; get file status |
382 (prog1 | |
383 (if (eq (buffer-size) 0) | |
384 0 ;; there were no news; indicate success | |
385 (if (re-search-forward | |
386 (concat "^\\([CMUP] \\)?" | |
387 ".*" | |
388 "\\( already contains the differences between \\)?") | |
389 nil t) | |
390 (cond | |
391 ;; Merge successful, we are in sync with repository now | |
392 ((or (match-string 2) | |
393 (string= (match-string 1) "U ") | |
394 (string= (match-string 1) "P ")) | |
395 (vc-file-setprop file 'vc-state 'up-to-date) | |
396 (vc-file-setprop file 'vc-checkout-time | |
397 (nth 5 (file-attributes file))) | |
398 0);; indicate success to the caller | |
399 ;; Merge successful, but our own changes are still in the file | |
400 ((string= (match-string 1) "M ") | |
401 (vc-file-setprop file 'vc-state 'edited) | |
402 0);; indicate success to the caller | |
403 ;; Conflicts detected! | |
404 (t | |
405 (vc-file-setprop file 'vc-state 'edited) | |
406 1);; signal the error to the caller | |
407 ) | |
408 (pop-to-buffer "*vc*") | |
409 (error "Couldn't analyze mcvs update result"))) | |
410 (message "Merging changes into %s...done" file)))) | |
411 | |
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
|
412 (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
|
413 "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
|
414 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
|
415 (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
|
416 |
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
|
417 |
50646 | 418 ;;; |
419 ;;; History functions | |
420 ;;; | |
421 | |
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
|
422 (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
|
423 "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
|
424 (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
|
425 ;; 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
|
426 ;; valid relative names. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
427 (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
|
428 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
|
429 (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
|
430 files "log"))) |
50646 | 431 |
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
|
432 (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
|
433 "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
|
434 (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
|
435 (vc-stay-local-p files))) |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
436 ;; 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
|
437 ;; 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
|
438 (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
|
439 (status |
55815
a6b86fce5676
(vc-mcvs-print-log, vc-mcvs-diff): Add optional `buffer' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53639
diff
changeset
|
440 (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
|
441 (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
|
442 files "diff" |
50901
d3bb1d77a4b1
(vc-mcvs-register, vc-mcvs-checkin, vc-mcvs-find-version)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50899
diff
changeset
|
443 (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
|
444 (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
|
445 (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
|
446 (if async 1 status))) ; async diff, pessimistic assumption. |
50646 | 447 |
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
|
448 (defun vc-mcvs-annotate-command (file buffer &optional revision) |
50646 | 449 "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
|
450 Optional arg REVISION is a revision to annotate from." |
50646 | 451 (vc-mcvs-command |
452 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
|
453 (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
|
454 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
|
455 (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
|
456 (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
|
457 (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
|
458 (delete-region (point-min) (1- (point))))) |
50646 | 459 |
460 (defalias 'vc-mcvs-annotate-current-time 'vc-cvs-annotate-current-time) | |
461 (defalias 'vc-mcvs-annotate-time 'vc-cvs-annotate-time) | |
462 | |
463 ;;; | |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
464 ;;; Tag system |
50646 | 465 ;;; |
466 | |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
467 (defun vc-mcvs-create-tag (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
|
468 "Assign to DIR's current revision a given NAME. |
50646 | 469 If BRANCHP is non-nil, the name is created as a branch (and the current |
470 workspace is immediately moved to that new branch)." | |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
471 (if (not branchp) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
472 (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
|
473 (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
|
474 (vc-mcvs-command nil 0 dir "switch" name))) |
50646 | 475 |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
476 (defun vc-mcvs-retrieve-tag (dir name update) |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
477 "Retrieve a tag at and below DIR. |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
478 NAME is the name of the tag; if it is empty, do a `cvs update'. |
50646 | 479 If UPDATE is non-nil, then update (resynch) any affected buffers." |
480 (with-current-buffer (get-buffer-create "*vc*") | |
481 (let ((default-directory dir) | |
482 (sticky-tag)) | |
483 (erase-buffer) | |
484 (if (or (not name) (string= name "")) | |
485 (vc-mcvs-command t 0 nil "update") | |
486 (vc-mcvs-command t 0 nil "update" "-r" name) | |
487 (setq sticky-tag name)) | |
488 (when update | |
489 (goto-char (point-min)) | |
490 (while (not (eobp)) | |
491 (if (looking-at "\\([CMUP]\\) \\(.*\\)") | |
492 (let* ((file (expand-file-name (match-string 2) dir)) | |
493 (state (match-string 1)) | |
494 (buffer (find-buffer-visiting file))) | |
495 (when buffer | |
496 (cond | |
497 ((or (string= state "U") | |
498 (string= state "P")) | |
499 (vc-file-setprop file 'vc-state 'up-to-date) | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
500 (vc-file-setprop file 'vc-working-revision nil) |
50646 | 501 (vc-file-setprop file 'vc-checkout-time |
502 (nth 5 (file-attributes file)))) | |
503 ((or (string= state "M") | |
504 (string= state "C")) | |
505 (vc-file-setprop file 'vc-state 'edited) | |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
506 (vc-file-setprop file 'vc-working-revision nil) |
50646 | 507 (vc-file-setprop file 'vc-checkout-time 0))) |
508 (vc-file-setprop file 'vc-mcvs-sticky-tag sticky-tag) | |
509 (vc-resynch-buffer file t t)))) | |
510 (forward-line 1)))))) | |
511 | |
512 | |
513 ;;; | |
514 ;;; Miscellaneous | |
515 ;;; | |
516 | |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
517 (defalias 'vc-mcvs-make-version-backups-p 'vc-stay-local-p |
50646 | 518 "Return non-nil if version backups should be made for FILE.") |
519 (defalias 'vc-mcvs-check-headers 'vc-cvs-check-headers) | |
520 | |
521 | |
522 ;;; | |
523 ;;; Internal functions | |
524 ;;; | |
525 | |
526 (defun vc-mcvs-command (buffer okstatus file &rest flags) | |
527 "A wrapper around `vc-do-command' for use in vc-mcvs.el. | |
528 The difference to vc-do-command is that this function always invokes `mcvs', | |
529 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
|
530 (let ((args (append '("--error-terminate") |
50667
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
531 (if (stringp vc-mcvs-global-switches) |
c475369e6995
(vc-mcvs-root): Cache the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50646
diff
changeset
|
532 (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
|
533 (append vc-mcvs-global-switches flags))))) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
534 (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
|
535 ;; No need to filter: do it the easy way. |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94805
diff
changeset
|
536 (apply 'vc-do-command (or buffer "*vc*") okstatus "mcvs" file args) |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
537 ;; We need to filter the output. |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
538 ;; 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
|
539 ;; 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
|
540 ;; (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
|
541 (vc-do-command |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94805
diff
changeset
|
542 (or buffer "*vc*") okstatus "sh" nil "-c" |
50952
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
543 (concat "mcvs " |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
544 (mapconcat |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
545 'shell-quote-argument |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
546 (append (remq nil args) |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
547 (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
|
548 " ") |
1731748fbe8c
(vc-mcvs-command): Filter output of `status'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50928
diff
changeset
|
549 " | mcvs filt"))))) |
50646 | 550 |
50928
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
551 (defun vc-mcvs-repository-hostname (dirname) |
dc235df7e226
(vc-mcvs-stay-local): Remove unused var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50924
diff
changeset
|
552 (vc-cvs-repository-hostname (vc-mcvs-root dirname))) |
50646 | 553 |
554 (defun vc-mcvs-dir-state-heuristic (dir) | |
555 "Find the Meta-CVS state of all files in DIR, using only local information." | |
556 (with-temp-buffer | |
557 (vc-cvs-get-entries dir) | |
558 (goto-char (point-min)) | |
559 (while (not (eobp)) | |
560 ;; Meta-MCVS-removed files are not taken under VC control. | |
561 (when (looking-at "/\\([^/]*\\)/[^/-]") | |
562 (let ((file (expand-file-name (match-string 1) dir))) | |
563 (unless (vc-file-getprop file 'vc-state) | |
564 (vc-cvs-parse-entry file t)))) | |
565 (forward-line 1)))) | |
566 | |
567 (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
|
568 (defalias 'vc-mcvs-valid-revision-number-p 'vc-cvs-valid-revision-number-p) |
50646 | 569 |
570 (provide 'vc-mcvs) | |
52401 | 571 |
57095
74d256616e05
(vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55815
diff
changeset
|
572 ;; arch-tag: a39c7c1c-5247-429d-88df-dd7187d2e704 |
50646 | 573 ;;; vc-mcvs.el ends here |