annotate lisp/vc-mcvs.el @ 55438:8ff66a576ed5

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