annotate lisp/vc-mcvs.el @ 91810:81c282959319

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