Mercurial > emacs
annotate lisp/vc-rcs.el @ 31546:09bc2badb9e6
(quail-translation-docstring): New variable.
(quail-show-keyboard-layout): Docstring modified.
(quail-select-current): Likewise.
(quail-build-decode-map): Change arg MAP to MAP-LIST to avoid
infinite recursive call.
(quail-help): Check quail-translation-docstring. Format of the
output changed.
(quail-help-insert-keymap-description): Adjusted for the above
change.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 11 Sep 2000 23:38:47 +0000 |
parents | f9d2d484e1e2 |
children | a2c432c6b343 |
rev | line source |
---|---|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1 ;;; vc-rcs.el --- support for RCS version-control |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
3 ;; Copyright (C) 1992,93,94,95,96,97,98,99,2000 Free Software Foundation, Inc. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
4 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
5 ;; Author: FSF (see vc.el for full credits) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
7 |
31520
f9d2d484e1e2
* vc-sccs.el (vc-sccs-register):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31476
diff
changeset
|
8 ;; $Id: vc-rcs.el,v 1.3 2000/09/07 20:02:38 fx Exp $ |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
9 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
11 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
15 ;; any later version. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
16 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
21 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
25 ;; Boston, MA 02111-1307, USA. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
26 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
27 ;;; Commentary: see vc.el |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
28 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
29 ;;; Code: |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
30 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
31 (defcustom vc-rcs-release nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
32 "*The release number of your RCS installation, as a string. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
33 If nil, VC itself computes this value when it is first needed." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
34 :type '(choice (const :tag "Auto" nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
35 (string :tag "Specified") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
36 (const :tag "Unknown" unknown)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
37 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
38 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
39 (defcustom vc-rcs-register-switches nil |
31476 | 40 "*Extra switches for registering a file in RCS. |
41 A string or list of strings. These are passed to the checkin program | |
42 by \\[vc-rcs-register]." | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
43 :type '(choice (const :tag "None" nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
44 (string :tag "Argument String") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
45 (repeat :tag "Argument List" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
46 :value ("") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
47 string)) |
31476 | 48 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
49 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
50 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
51 (defcustom vc-rcs-checkin-switches nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
52 "*A string or list of strings specifying extra switches for RCS checkin. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
53 These are passed to the checkin program by \\[vc-rcs-checkin]." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
54 :type '(choice (const :tag "None" nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
55 (string :tag "Argument String") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
56 (repeat :tag "Argument List" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
57 :value ("") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
58 string)) |
31476 | 59 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
60 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
61 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
62 (defcustom vc-rcs-checkout-switches nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
63 "*A string or list of strings specifying extra switches for RCS checkout. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
64 These are passed to the checkout program by \\[vc-rcs-checkout]." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
65 :type '(choice (const :tag "None" nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
66 (string :tag "Argument String") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
67 (repeat :tag "Argument List" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
68 :value ("") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
69 string)) |
31476 | 70 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
71 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
72 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
73 (defcustom vc-rcs-header (or (cdr (assoc 'RCS vc-header-alist)) '("\$Id\$")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
74 "*Header keywords to be inserted by `vc-insert-headers'." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
75 :type 'string |
31476 | 76 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
77 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
78 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
79 (defcustom vc-rcsdiff-knows-brief nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
80 "*Indicates whether rcsdiff understands the --brief option. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
81 The value is either `yes', `no', or nil. If it is nil, VC tries |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
82 to use --brief and sets this variable to remember whether it worked." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
83 :type '(choice (const :tag "Work out" nil) (const yes) (const no)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
84 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
85 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
86 ;;;###autoload |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
87 (defcustom vc-rcs-master-templates |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
88 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
89 "*Where to look for RCS master files. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
90 For a description of possible values, see `vc-check-master-templates'." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
91 :type '(choice (const :tag "Use standard RCS file names" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
92 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
93 (repeat :tag "User-specified" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
94 (choice string |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
95 function))) |
31476 | 96 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
97 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
98 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
99 ;;;###autoload |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
100 (progn (defun vc-rcs-registered (f) (vc-default-registered 'RCS f))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
101 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
102 (defun vc-rcs-state (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
103 "Implementation of `vc-state' for RCS." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
104 (or (boundp 'vc-rcs-headers-result) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
105 (and vc-consult-headers |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
106 (vc-rcs-consult-headers file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
107 (let ((state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
108 ;; vc-workfile-version might not be known; in that case the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
109 ;; property is nil. vc-rcs-fetch-master-state knows how to |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
110 ;; handle that. |
31476 | 111 (vc-rcs-fetch-master-state file |
112 (vc-file-getprop file | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
113 'vc-workfile-version)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
114 (if (eq state 'up-to-date) |
31476 | 115 (if (vc-workfile-unchanged-p file) |
116 'up-to-date | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
117 'unlocked-changes) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
118 state))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
119 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
120 (defun vc-rcs-state-heuristic (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
121 "State heuristic for RCS." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
122 (let (vc-rcs-headers-result) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
123 (if (and vc-consult-headers |
31476 | 124 (setq vc-rcs-headers-result |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
125 (vc-rcs-consult-headers file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
126 (eq vc-rcs-headers-result 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
127 (let ((state (vc-file-getprop file 'vc-state))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
128 ;; If the headers say that the file is not locked, the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
129 ;; permissions can tell us whether locking is used for |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
130 ;; the file or not. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
131 (if (and (eq state 'up-to-date) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
132 (not (vc-mistrust-permissions file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
133 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
134 ((string-match ".rw..-..-." (nth 8 (file-attributes file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
135 (vc-file-setprop file 'vc-checkout-model 'implicit)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
136 ((string-match ".r-..-..-." (nth 8 (file-attributes file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
137 (vc-file-setprop file 'vc-checkout-model 'locking)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
138 state) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
139 (if (not (vc-mistrust-permissions file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
140 (let* ((attributes (file-attributes file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
141 (owner-uid (nth 2 attributes)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
142 (permissions (nth 8 attributes))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
143 (cond ((string-match ".r-..-..-." permissions) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
144 (vc-file-setprop file 'vc-checkout-model 'locking) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
145 'up-to-date) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
146 ((string-match ".rw..-..-." permissions) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
147 (if (file-ownership-preserved-p file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
148 'edited |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
149 (vc-user-login-name owner-uid))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
150 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
151 ;; Strange permissions. Fall through to |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
152 ;; expensive state computation. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
153 (vc-rcs-state file)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
154 (vc-rcs-state file))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
155 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
156 (defun vc-rcs-workfile-version (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
157 "RCS-specific version of `vc-workfile-version'." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
158 (or (and vc-consult-headers |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
159 (vc-rcs-consult-headers file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
160 (vc-file-getprop file 'vc-workfile-version)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
161 (progn |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
162 (vc-rcs-fetch-master-state file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
163 (vc-file-getprop file 'vc-workfile-version)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
164 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
165 (defun vc-rcs-checkout-model (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
166 "RCS-specific version of `vc-checkout-model'." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
167 (vc-rcs-consult-headers file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
168 (or (vc-file-getprop file 'vc-checkout-model) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
169 (progn (vc-rcs-fetch-master-state file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
170 (vc-file-getprop file 'vc-checkout-model)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
171 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
172 ;;; internal code |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
173 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
174 (defun vc-rcs-find-most-recent-rev (branch) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
175 "Find most recent revision on BRANCH." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
176 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
177 (let ((latest-rev -1) value) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
178 (while (re-search-forward (concat "^\\(" (regexp-quote branch) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
179 "\\.\\([0-9]+\\)\\)\ndate[ \t]+[0-9.]+;") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
180 nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
181 (let ((rev (string-to-number (match-string 2)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
182 (when (< latest-rev rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
183 (setq latest-rev rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
184 (setq value (match-string 1))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
185 value)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
186 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
187 (defun vc-rcs-fetch-master-state (file &optional workfile-version) |
31476 | 188 "Compute the master file's idea of the state of FILE. |
189 If a WORKFILE-VERSION is given, compute the state of that version, | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
190 otherwise determine the workfile version based on the master file. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
191 This function sets the properties `vc-workfile-version' and |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
192 `vc-checkout-model' to their correct values, based on the master |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
193 file." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
194 (with-temp-buffer |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
195 (vc-insert-file (vc-name file) "^[0-9]") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
196 (let ((workfile-is-latest nil)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
197 (unless workfile-version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
198 (let ((default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
199 ;; Workfile version not known yet. Determine that first. It |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
200 ;; is either the head of the trunk, the head of the default |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
201 ;; branch, or the "default branch" itself, if that is a full |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
202 ;; revision number. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
203 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
204 ;; no default branch |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
205 ((or (not default-branch) (string= "" default-branch)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
206 (setq workfile-version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
207 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
208 (setq workfile-is-latest t)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
209 ;; default branch is actually a revision |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
210 ((string-match "^[0-9]+\\.[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*$" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
211 default-branch) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
212 (setq workfile-version default-branch)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
213 ;; else, search for the head of the default branch |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
214 (t (vc-insert-file (vc-name file) "^desc") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
215 (setq workfile-version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
216 (vc-rcs-find-most-recent-rev default-branch)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
217 (setq workfile-is-latest t))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
218 (vc-file-setprop file 'vc-workfile-version workfile-version))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
219 ;; Check strict locking |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
220 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
221 (vc-file-setprop file 'vc-checkout-model |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
222 (if (re-search-forward ";[ \t\n]*strict;" nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
223 'locking 'implicit)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
224 ;; Compute state of workfile version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
225 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
226 (let ((locking-user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
227 (vc-parse-buffer (concat "^locks[ \t\n]+[^;]*[ \t\n]+\\([^:]+\\):" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
228 (regexp-quote workfile-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
229 "[^0-9.]") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
230 1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
231 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
232 ;; not locked |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
233 ((not locking-user) |
31476 | 234 (if (or workfile-is-latest |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
235 (vc-rcs-latest-on-branch-p file workfile-version)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
236 ;; workfile version is latest on branch |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
237 'up-to-date |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
238 ;; workfile version is not latest on branch |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
239 'needs-patch)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
240 ;; locked by the calling user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
241 ((and (stringp locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
242 (string= locking-user (vc-user-login-name))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
243 (if (or (eq (vc-checkout-model file) 'locking) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
244 workfile-is-latest |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
245 (vc-rcs-latest-on-branch-p file workfile-version)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
246 'edited |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
247 ;; Locking is not used for the file, but the owner does |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
248 ;; have a lock, and there is a higher version on the current |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
249 ;; branch. Not sure if this can occur, and if it is right |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
250 ;; to use `needs-merge' in this case. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
251 'needs-merge)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
252 ;; locked by somebody else |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
253 ((stringp locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
254 locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
255 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
256 (error "Error getting state of RCS file"))))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
257 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
258 (defun vc-rcs-consult-headers (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
259 "Search for RCS headers in FILE, and set properties accordingly. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
260 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
261 Returns: nil if no headers were found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
262 'rev if a workfile revision was found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
263 'rev-and-lock if revision and lock info was found" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
264 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
265 ((not (get-file-buffer file)) nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
266 ((let (status version locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
267 (save-excursion |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
268 (set-buffer (get-file-buffer file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
269 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
270 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
271 ;; search for $Id or $Header |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
272 ;; ------------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
273 ;; The `\ 's below avoid an RCS 5.7 bug when checking in this file. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
274 ((or (and (search-forward "$Id\ : " nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
275 (looking-at "[^ ]+ \\([0-9.]+\\) ")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
276 (and (progn (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
277 (search-forward "$Header\ : " nil t)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
278 (looking-at "[^ ]+ \\([0-9.]+\\) "))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
279 (goto-char (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
280 ;; if found, store the revision number ... |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
281 (setq version (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
282 ;; ... and check for the locking state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
283 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
284 ((looking-at |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
285 (concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] " ; date |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
286 "[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
287 "[^ ]+ [^ ]+ ")) ; author & state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
288 (goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
289 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
290 ;; unlocked revision |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
291 ((looking-at "\\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
292 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
293 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
294 ;; revision is locked by some user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
295 ((looking-at "\\([^ ]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
296 (setq locking-user (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
297 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
298 ;; everything else: false |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
299 (nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
300 ;; unexpected information in |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
301 ;; keyword string --> quit |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
302 (nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
303 ;; search for $Revision |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
304 ;; -------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
305 ((re-search-forward (concat "\\$" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
306 "Revision: \\([0-9.]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
307 nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
308 ;; if found, store the revision number ... |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
309 (setq version (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
310 ;; and see if there's any lock information |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
311 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
312 (if (re-search-forward (concat "\\$" "Locker:") nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
313 (cond ((looking-at " \\([^ ]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
314 (setq locking-user (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
315 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
316 ((looking-at " *\\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
317 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
318 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
319 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
320 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
321 (setq status 'rev-and-lock))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
322 (setq status 'rev))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
323 ;; else: nothing found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
324 ;; ------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
325 (t nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
326 (if status (vc-file-setprop file 'vc-workfile-version version)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
327 (and (eq status 'rev-and-lock) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
328 (vc-file-setprop file 'vc-state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
329 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
330 ((eq locking-user 'none) 'up-to-date) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
331 ((string= locking-user (vc-user-login-name)) 'edited) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
332 (t locking-user))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
333 ;; If the file has headers, we don't want to query the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
334 ;; master file, because that would eliminate all the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
335 ;; performance gain the headers brought us. We therefore |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
336 ;; use a heuristic now to find out whether locking is used |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
337 ;; for this file. If we trust the file permissions, and the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
338 ;; file is not locked, then if the file is read-only we |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
339 ;; assume that locking is used for the file, otherwise |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
340 ;; locking is not used. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
341 (not (vc-mistrust-permissions file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
342 (vc-up-to-date-p file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
343 (if (string-match ".r-..-..-." (nth 8 (file-attributes file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
344 (vc-file-setprop file 'vc-checkout-model 'locking) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
345 (vc-file-setprop file 'vc-checkout-model 'implicit))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
346 status)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
347 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
348 (defun vc-rcs-workfile-unchanged-p (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
349 "RCS-specific implementation of vc-workfile-unchanged-p." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
350 ;; Try to use rcsdiff --brief. If rcsdiff does not understand that, |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
351 ;; do a double take and remember the fact for the future |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
352 (let* ((version (concat "-r" (vc-workfile-version file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
353 (status (if (eq vc-rcsdiff-knows-brief 'no) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
354 (vc-do-command nil 1 "rcsdiff" file version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
355 (vc-do-command nil 2 "rcsdiff" file "--brief" version)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
356 (if (eq status 2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
357 (if (not vc-rcsdiff-knows-brief) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
358 (setq vc-rcsdiff-knows-brief 'no |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
359 status (vc-do-command nil 1 "rcsdiff" file version)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
360 (error "rcsdiff failed")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
361 (if (not vc-rcsdiff-knows-brief) (setq vc-rcsdiff-knows-brief 'yes))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
362 ;; The workfile is unchanged if rcsdiff found no differences. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
363 (zerop status))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
364 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
365 (defun vc-rcs-trunk-p (rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
366 "Return t if REV is an RCS revision on the trunk." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
367 (not (eq nil (string-match "\\`[0-9]+\\.[0-9]+\\'" rev)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
368 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
369 (defun vc-rcs-branch-part (rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
370 "Return the branch part of an RCS revision number REV" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
371 (substring rev 0 (string-match "\\.[0-9]+\\'" rev))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
372 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
373 (defun vc-rcs-latest-on-branch-p (file &optional version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
374 "Return non-nil if workfile version of FILE is the latest on its branch. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
375 When VERSION is given, perform check for that version." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
376 (unless version (setq version (vc-workfile-version file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
377 (with-temp-buffer |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
378 (string= version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
379 (if (vc-rcs-trunk-p version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
380 (progn |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
381 ;; Compare VERSION to the head version number. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
382 (vc-insert-file (vc-name file) "^[0-9]") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
383 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
384 ;; If we are not on the trunk, we need to examine the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
385 ;; whole current branch. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
386 (vc-insert-file (vc-name file) "^desc") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
387 (vc-rcs-find-most-recent-rev (vc-rcs-branch-part version)))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
388 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
389 (defun vc-rcs-branch-p (rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
390 "Return t if REV is an RCS branch revision" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
391 (not (eq nil (string-match "\\`[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*\\'" rev)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
392 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
393 (defun vc-rcs-minor-part (rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
394 "Return the minor version number of an RCS revision number REV." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
395 (string-match "[0-9]+\\'" rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
396 (substring rev (match-beginning 0) (match-end 0))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
397 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
398 (defun vc-rcs-previous-version (rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
399 "Guess the previous RCS version number" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
400 (let ((branch (vc-rcs-branch-part rev)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
401 (minor-num (string-to-number (vc-rcs-minor-part rev)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
402 (if (> minor-num 1) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
403 ;; version does probably not start a branch or release |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
404 (concat branch "." (number-to-string (1- minor-num))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
405 (if (vc-rcs-trunk-p rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
406 ;; we are at the beginning of the trunk -- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
407 ;; don't know anything to return here |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
408 "" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
409 ;; we are at the beginning of a branch -- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
410 ;; return version of starting point |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
411 (vc-rcs-branch-part branch))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
412 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
413 (defun vc-rcs-print-log (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
414 "Get change log associated with FILE." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
415 (vc-do-command t 0 "rlog" (vc-name file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
416 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
417 (defun vc-rcs-show-log-entry (version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
418 (when (re-search-forward |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
419 ;; also match some context, for safety |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
420 (concat "----\nrevision " version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
421 "\\(\tlocked by:.*\n\\|\n\\)date: ") nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
422 ;; set the display window so that |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
423 ;; the whole log entry is displayed |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
424 (let (start end lines) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
425 (beginning-of-line) (forward-line -1) (setq start (point)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
426 (if (not (re-search-forward "^----*\nrevision" nil t)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
427 (setq end (point-max)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
428 (beginning-of-line) (forward-line -1) (setq end (point))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
429 (setq lines (count-lines start end)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
430 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
431 ;; if the global information and this log entry fit |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
432 ;; into the window, display from the beginning |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
433 ((< (count-lines (point-min) end) (window-height)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
434 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
435 (recenter 0) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
436 (goto-char start)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
437 ;; if the whole entry fits into the window, |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
438 ;; display it centered |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
439 ((< (1+ lines) (window-height)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
440 (goto-char start) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
441 (recenter (1- (- (/ (window-height) 2) (/ lines 2))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
442 ;; otherwise (the entry is too large for the window), |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
443 ;; display from the start |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
444 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
445 (goto-char start) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
446 (recenter 0)))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
447 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
448 (defun vc-rcs-assign-name (file name) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
449 "Assign to FILE's latest version a given NAME." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
450 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-n" name ":"))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
451 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
452 (defun vc-rcs-merge (file first-version &optional second-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
453 "Merge changes into current working copy of FILE. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
454 The changes are between FIRST-VERSION and SECOND-VERSION." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
455 (vc-do-command nil 1 "rcsmerge" (vc-name file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
456 "-kk" ; ignore keyword conflicts |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
457 (concat "-r" first-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
458 (if second-version (concat "-r" second-version)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
459 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
460 (defun vc-rcs-check-headers () |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
461 "Check if the current file has any headers in it." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
462 (save-excursion |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
463 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
464 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\ |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
465 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
466 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
467 (defun vc-rcs-clear-headers () |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
468 "Implementation of vc-clear-headers for RCS." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
469 (let ((case-fold-search nil)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
470 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
471 (while (re-search-forward |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
472 (concat "\\$\\(Author\\|Date\\|Header\\|Id\\|Locker\\|Name\\|" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
473 "RCSfile\\|Revision\\|Source\\|State\\): [^$\n]+\\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
474 nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
475 (replace-match "$\\1$")))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
476 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
477 (defun vc-rcs-steal-lock (file &optional rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
478 "Steal the lock on the current workfile for FILE and revision REV. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
479 Needs RCS 5.6.2 or later for -M." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
480 (vc-do-command nil 0 "rcs" (vc-name file) "-M" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
481 (concat "-u" rev) (concat "-l" rev))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
482 |
31404
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
483 (defun vc-rcs-cancel-version (file writable) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
484 "Undo the most recent checkin of FILE. |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
485 WRITABLE non-nil means previous version should be locked." |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
486 (let* ((target (vc-workfile-version file)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
487 (previous (if (vc-trunk-p target) "" (vc-branch-part target))) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
488 (config (current-window-configuration)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
489 (done nil)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
490 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
491 ;; Check out the most recent remaining version. If it fails, because |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
492 ;; the whole branch got deleted, do a double-take and check out the |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
493 ;; version where the branch started. |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
494 (while (not done) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
495 (condition-case err |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
496 (progn |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
497 (vc-do-command nil 0 "co" (vc-name file) "-f" |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
498 (concat (if writable "-l" "-u") previous)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
499 (setq done t)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
500 (error (set-buffer "*vc*") |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
501 (goto-char (point-min)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
502 (if (search-forward "no side branches present for" nil t) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
503 (progn (setq previous (vc-branch-part previous)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
504 (vc-do-command nil 0 "rcs" (vc-name file) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
505 (concat "-b" previous)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
506 ;; vc-do-command popped up a window with |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
507 ;; the error message. Get rid of it, by |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
508 ;; restoring the old window configuration. |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
509 (set-window-configuration config)) |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
510 ;; No, it was some other error: re-signal it. |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31383
diff
changeset
|
511 (signal (car err) (cdr err)))))))) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
512 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
513 (defun vc-rcs-revert (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
514 "Revert FILE to the version it was based on." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
515 (vc-do-command nil 0 "co" (vc-name file) "-f" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
516 (concat "-u" (vc-workfile-version file)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
517 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
518 (defun vc-rcs-rename-file (old new) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
519 ;; Just move the master file (using vc-rcs-master-templates). |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
520 (vc-rename-master (vc-name old) new vc-rcs-master-templates)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
521 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
522 (defun vc-release-greater-or-equal (r1 r2) |
31476 | 523 "Compare release numbers, represented as strings. |
524 Release components are assumed cardinal numbers, not decimal fractions | |
525 \(5.10 is a higher release than 5.9\). Omitted fields are considered | |
526 lower \(5.6.7 is earlier than 5.6.7.1\). Comparison runs till the end | |
527 of the string is found, or a non-numeric component shows up \(5.6.7 is | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
528 earlier than \"5.6.7 beta\", which is probably not what you want in |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
529 some cases\). This code is suitable for existing RCS release numbers. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
530 CVS releases are handled reasonably, too \(1.3 < 1.4* < 1.5\)." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
531 (let (v1 v2 i1 i2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
532 (catch 'done |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
533 (or (and (string-match "^\\.?\\([0-9]+\\)" r1) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
534 (setq i1 (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
535 (setq v1 (string-to-number (match-string 1 r1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
536 (or (and (string-match "^\\.?\\([0-9]+\\)" r2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
537 (setq i2 (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
538 (setq v2 (string-to-number (match-string 1 r2))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
539 (if (> v1 v2) (throw 'done t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
540 (if (< v1 v2) (throw 'done nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
541 (throw 'done |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
542 (vc-release-greater-or-equal |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
543 (substring r1 i1) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
544 (substring r2 i2))))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
545 (throw 'done t))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
546 (or (and (string-match "^\\.?\\([0-9]+\\)" r2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
547 (throw 'done nil)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
548 (throw 'done t))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
549 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
550 (defun vc-rcs-release-p (release) |
31476 | 551 "Return t if we have RELEASE or better." |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
552 (let ((installation (vc-rcs-system-release))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
553 (if (and installation |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
554 (not (eq installation 'unknown))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
555 (vc-release-greater-or-equal installation release)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
556 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
557 (defun vc-rcs-checkin (file rev comment) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
558 "RCS-specific version of `vc-backend-checkin'." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
559 (let ((switches (if (stringp vc-checkin-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
560 (list vc-checkin-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
561 vc-checkin-switches))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
562 (let ((old-version (vc-workfile-version file)) new-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
563 (apply 'vc-do-command nil 0 "ci" (vc-name file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
564 ;; if available, use the secure check-in option |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
565 (and (vc-rcs-release-p "5.6.4") "-j") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
566 (concat (if vc-keep-workfiles "-u" "-r") rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
567 (concat "-m" comment) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
568 switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
569 (vc-file-setprop file 'vc-workfile-version nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
570 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
571 ;; determine the new workfile version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
572 (set-buffer "*vc*") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
573 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
574 (when (or (re-search-forward |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
575 "new revision: \\([0-9.]+\\);" nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
576 (re-search-forward |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
577 "reverting to previous revision \\([0-9.]+\\)" nil t)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
578 (setq new-version (match-string 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
579 (vc-file-setprop file 'vc-workfile-version new-version)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
580 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
581 ;; if we got to a different branch, adjust the default |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
582 ;; branch accordingly |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
583 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
584 ((and old-version new-version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
585 (not (string= (vc-rcs-branch-part old-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
586 (vc-rcs-branch-part new-version)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
587 (vc-do-command nil 0 "rcs" (vc-name file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
588 (if (vc-rcs-trunk-p new-version) "-b" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
589 (concat "-b" (vc-rcs-branch-part new-version)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
590 ;; If this is an old RCS release, we might have |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
591 ;; to remove a remaining lock. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
592 (if (not (vc-rcs-release-p "5.6.2")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
593 ;; exit status of 1 is also accepted. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
594 ;; It means that the lock was removed before. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
595 (vc-do-command nil 1 "rcs" (vc-name file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
596 (concat "-u" old-version)))))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
597 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
598 (defun vc-rcs-system-release () |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
599 "Return the RCS release installed on this system, as a string. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
600 Return symbol UNKNOWN if the release cannot be deducted. The user can |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
601 override this using variable `vc-rcs-release'. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
602 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
603 If the user has not set variable `vc-rcs-release' and it is nil, |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
604 variable `vc-rcs-release' is set to the returned value." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
605 (or vc-rcs-release |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
606 (setq vc-rcs-release |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
607 (or (and (zerop (vc-do-command nil nil "rcs" nil "-V")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
608 (with-current-buffer (get-buffer "*vc*") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
609 (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
610 'unknown)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
611 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
612 (defun vc-rcs-diff (file &optional oldvers newvers) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
613 "Get a difference report using RCS between two versions of FILE." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
614 (if (not oldvers) (setq oldvers (vc-workfile-version file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
615 ;; If we know that --brief is not supported, don't try it. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
616 (let* ((diff-switches-list (if (listp diff-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
617 diff-switches |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
618 (list diff-switches))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
619 (options (append (list "-q" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
620 (concat "-r" oldvers) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
621 (and newvers (concat "-r" newvers))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
622 diff-switches-list))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
623 (apply 'vc-do-command t 1 "rcsdiff" file options))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
624 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
625 (defun vc-rcs-responsible-p (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
626 "Return non-nil if RCS thinks it would be responsible for registering FILE." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
627 ;; TODO: check for all the patterns in vc-rcs-master-templates |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
628 (file-directory-p (expand-file-name "RCS" (file-name-directory file)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
629 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
630 (defun vc-rcs-register (file &optional rev comment) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
631 "Register FILE into the RCS version-control system. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
632 REV is the optional revision number for the file. COMMENT can be used |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
633 to provide an initial description of FILE. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
634 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
635 `vc-register-switches' and `vc-rcs-register-switches' are passed to |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
636 the RCS command (in that order). |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
637 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
638 Automatically retrieve a read-only version of the file with keywords |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
639 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
640 (let ((subdir (expand-file-name "RCS" (file-name-directory file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
641 (switches (list |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
642 (if (stringp vc-register-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
643 (list vc-register-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
644 vc-register-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
645 (if (stringp vc-rcs-register-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
646 (list vc-rcs-register-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
647 vc-rcs-register-switches)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
648 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
649 (and (not (file-exists-p subdir)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
650 (not (directory-files (file-name-directory file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
651 nil ".*,v$" t)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
652 (yes-or-no-p "Create RCS subdirectory? ") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
653 (make-directory subdir)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
654 (apply 'vc-do-command nil 0 "ci" file |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
655 ;; if available, use the secure registering option |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
656 (and (vc-rcs-release-p "5.6.4") "-i") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
657 (concat (if vc-keep-workfiles "-u" "-r") rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
658 (and comment (concat "-t-" comment)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
659 switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
660 ;; parse output to find master file name and workfile version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
661 (with-current-buffer "*vc*" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
662 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
663 (let ((name (if (looking-at (concat "^\\(.*\\) <-- " |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
664 (file-name-nondirectory file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
665 (match-string 1)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
666 (if (not name) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
667 ;; if we couldn't find the master name, |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
668 ;; run vc-rcs-registered to get it |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
669 ;; (will be stored into the vc-name property) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
670 (vc-rcs-registered file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
671 (vc-file-setprop file 'vc-name |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
672 (if (file-name-absolute-p name) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
673 name |
31476 | 674 (expand-file-name |
675 name | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
676 (file-name-directory file)))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
677 (vc-file-setprop file 'vc-workfile-version |
31476 | 678 (if (re-search-forward |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
679 "^initial revision: \\([0-9.]+\\).*\n" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
680 nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
681 (match-string 1)))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
682 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
683 (defun vc-rcs-checkout (file &optional writable rev workfile) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
684 "Retrieve a copy of a saved version of FILE into a workfile." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
685 (let ((filename (or workfile file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
686 (file-buffer (get-file-buffer file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
687 switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
688 (message "Checking out %s..." filename) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
689 (save-excursion |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
690 ;; Change buffers to get local value of vc-checkout-switches. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
691 (if file-buffer (set-buffer file-buffer)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
692 (setq switches (if (stringp vc-checkout-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
693 (list vc-checkout-switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
694 vc-checkout-switches)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
695 ;; Save this buffer's default-directory |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
696 ;; and use save-excursion to make sure it is restored |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
697 ;; in the same buffer it was saved in. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
698 (let ((default-directory default-directory)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
699 (save-excursion |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
700 ;; Adjust the default-directory so that the check-out creates |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
701 ;; the file in the right place. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
702 (setq default-directory (file-name-directory filename)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
703 (if workfile ;; RCS |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
704 ;; RCS can't check out into arbitrary file names directly. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
705 ;; Use `co -p' and make stdout point to the correct file. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
706 (let ((vc-modes (logior (file-modes (vc-name file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
707 (if writable 128 0))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
708 (failed t)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
709 (unwind-protect |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
710 (progn |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
711 (let ((coding-system-for-read 'no-conversion) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
712 (coding-system-for-write 'no-conversion)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
713 (with-temp-file filename |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
714 (apply 'vc-do-command |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
715 (current-buffer) 0 "co" (vc-name file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
716 "-q" ;; suppress diagnostic output |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
717 (if writable "-l") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
718 (concat "-p" rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
719 switches))) |
31476 | 720 (set-file-modes filename |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
721 (logior (file-modes (vc-name file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
722 (if writable 128 0))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
723 (setq failed nil)) |
31476 | 724 (and failed (file-exists-p filename) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
725 (delete-file filename)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
726 (let (new-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
727 ;; if we should go to the head of the trunk, |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
728 ;; clear the default branch first |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
729 (and rev (string= rev "") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
730 (vc-do-command nil 0 "rcs" (vc-name file) "-b")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
731 ;; now do the checkout |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
732 (apply 'vc-do-command |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
733 nil 0 "co" (vc-name file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
734 ;; If locking is not strict, force to overwrite |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
735 ;; the writable workfile. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
736 (if (eq (vc-checkout-model file) 'implicit) "-f") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
737 (if writable "-l") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
738 (if rev (concat "-r" rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
739 ;; if no explicit revision was specified, |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
740 ;; check out that of the working file |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
741 (let ((workrev (vc-workfile-version file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
742 (if workrev (concat "-r" workrev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
743 nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
744 switches) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
745 ;; determine the new workfile version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
746 (with-current-buffer "*vc*" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
747 (setq new-version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
748 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
749 (vc-file-setprop file 'vc-workfile-version new-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
750 ;; if necessary, adjust the default branch |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
751 (and rev (not (string= rev "")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
752 (vc-do-command |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
753 nil 0 "rcs" (vc-name file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
754 (concat "-b" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
755 (if (vc-rcs-latest-on-branch-p file new-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
756 (if (vc-rcs-trunk-p new-version) nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
757 (vc-rcs-branch-part new-version)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
758 new-version))))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
759 (message "Checking out %s...done" filename))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
760 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
761 (provide 'vc-rcs) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
762 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
763 ;;; vc-rcs.el ends here |