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