annotate lisp/vc-mcvs.el @ 100214:188994c9d7fe

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