annotate lisp/vc-mcvs.el @ 50680:ae1e2c38d746

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