Mercurial > emacs
annotate lisp/vc-rcs.el @ 40819:668787248f9b
* dired.el (dired-move-to-filename-regexp):
Do not distinguish between ASCII letters and non-ASCII characters.
Don't allow comma except in the form "month day, year".
Don't allow space between month name and comma.
Clean up the code that checks for trailing period, comma, and space.
Remove now-obsolete comments, and add more commentary about
Japanese dates.
Always gobble up trailing spaces, instead of doing it only sometimes.
author | Paul Eggert <eggert@twinsun.com> |
---|---|
date | Wed, 07 Nov 2001 21:59:39 +0000 |
parents | d13c2139752b |
children | 6301bb6ec388 |
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 |
35830 | 3 ;; Copyright (C) 1992,93,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. |
31383
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 |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38436
diff
changeset
|
8 ;; $Id: vc-rcs.el,v 1.20 2001/07/16 12:22:59 pj 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 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36712
diff
changeset
|
27 ;;; Commentary: |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36712
diff
changeset
|
28 |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36712
diff
changeset
|
29 ;; See vc.el |
31383
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 ;;; Code: |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
32 |
33560 | 33 ;;; |
34 ;;; Customization options | |
35 ;;; | |
36 | |
31840
a05558c54226
(toplevel): Require `vc' when compiling.
Gerd Moellmann <gerd@gnu.org>
parents:
31835
diff
changeset
|
37 (eval-when-compile |
35822
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
38 (require 'cl) |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
39 (require 'vc)) |
31840
a05558c54226
(toplevel): Require `vc' when compiling.
Gerd Moellmann <gerd@gnu.org>
parents:
31835
diff
changeset
|
40 |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
41 (defcustom vc-rcs-release nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
42 "*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
|
43 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
|
44 :type '(choice (const :tag "Auto" nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
45 (string :tag "Specified") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
46 (const :tag "Unknown" unknown)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
47 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
48 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
49 (defcustom vc-rcs-register-switches nil |
31476 | 50 "*Extra switches for registering a file in RCS. |
51 A string or list of strings. These are passed to the checkin program | |
52 by \\[vc-rcs-register]." | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
53 :type '(choice (const :tag "None" nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
54 (string :tag "Argument String") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
55 (repeat :tag "Argument List" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
56 :value ("") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
57 string)) |
31476 | 58 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
59 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
60 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
61 (defcustom vc-rcs-checkin-switches nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
62 "*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
|
63 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
|
64 :type '(choice (const :tag "None" nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
65 (string :tag "Argument String") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
66 (repeat :tag "Argument List" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
67 :value ("") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
68 string)) |
31476 | 69 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
70 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
71 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
72 (defcustom vc-rcs-checkout-switches nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
73 "*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
|
74 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
|
75 :type '(choice (const :tag "None" nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
76 (string :tag "Argument String") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
77 (repeat :tag "Argument List" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
78 :value ("") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
79 string)) |
31476 | 80 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
81 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
82 |
35822
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
83 (defcustom vc-rcs-diff-switches nil |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
84 "*A string or list of strings specifying extra switches for rcsdiff under VC." |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
85 :type '(choice (const :tag "None" nil) |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
86 (string :tag "Argument String") |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
87 (repeat :tag "Argument List" |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
88 :value ("") |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
89 string)) |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
90 :version "21.1" |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
91 :group 'vc) |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
92 |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
93 (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
|
94 "*Header keywords to be inserted by `vc-insert-headers'." |
35178 | 95 :type '(repeat string) |
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 (defcustom vc-rcsdiff-knows-brief nil |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
100 "*Indicates whether rcsdiff understands the --brief option. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
101 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
|
102 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
|
103 :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
|
104 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
105 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
106 ;;;###autoload |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
107 (defcustom vc-rcs-master-templates |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
108 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
109 "*Where to look for RCS master files. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
110 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
|
111 :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
|
112 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
113 (repeat :tag "User-specified" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
114 (choice string |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
115 function))) |
31476 | 116 :version "21.1" |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
117 :group 'vc) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
118 |
33560 | 119 |
120 ;;; | |
121 ;;; State-querying functions | |
122 ;;; | |
123 | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
124 ;;;###autoload |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
125 (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
|
126 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
127 (defun vc-rcs-state (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
128 "Implementation of `vc-state' for RCS." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
129 (or (boundp 'vc-rcs-headers-result) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
130 (and vc-consult-headers |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
131 (vc-rcs-consult-headers file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
132 (let ((state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
133 ;; 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
|
134 ;; 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
|
135 ;; handle that. |
31476 | 136 (vc-rcs-fetch-master-state file |
137 (vc-file-getprop file | |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
138 'vc-workfile-version)))) |
33636
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
139 (if (not (eq state 'up-to-date)) |
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
140 state |
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
141 (require 'vc) |
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
142 (if (vc-workfile-unchanged-p file) |
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
143 'up-to-date |
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
144 (if (eq (vc-checkout-model file) 'locking) |
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
145 'unlocked-changes |
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
146 'edited))))) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
147 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
148 (defun vc-rcs-state-heuristic (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
149 "State heuristic for RCS." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
150 (let (vc-rcs-headers-result) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
151 (if (and vc-consult-headers |
31476 | 152 (setq vc-rcs-headers-result |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
153 (vc-rcs-consult-headers file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
154 (eq vc-rcs-headers-result 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
155 (let ((state (vc-file-getprop file 'vc-state))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
156 ;; 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
|
157 ;; 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
|
158 ;; the file or not. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
159 (if (and (eq state 'up-to-date) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
160 (not (vc-mistrust-permissions file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
161 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
162 ((string-match ".rw..-..-." (nth 8 (file-attributes file))) |
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
163 (vc-file-setprop file 'vc-checkout-model 'implicit) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
164 (setq state |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
165 (if (vc-rcs-workfile-is-newer file) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
166 'edited |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
167 'up-to-date))) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
168 ((string-match ".r-..-..-." (nth 8 (file-attributes file))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
169 (vc-file-setprop file 'vc-checkout-model 'locking)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
170 state) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
171 (if (not (vc-mistrust-permissions file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
172 (let* ((attributes (file-attributes file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
173 (owner-uid (nth 2 attributes)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
174 (permissions (nth 8 attributes))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
175 (cond ((string-match ".r-..-..-." permissions) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
176 (vc-file-setprop file 'vc-checkout-model 'locking) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
177 'up-to-date) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
178 ((string-match ".rw..-..-." permissions) |
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
179 (if (eq (vc-checkout-model file) 'locking) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
180 (if (file-ownership-preserved-p file) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
181 'edited |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
182 (vc-user-login-name owner-uid)) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
183 (if (vc-rcs-workfile-is-newer file) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
184 'edited |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
185 'up-to-date))) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
186 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
187 ;; Strange permissions. Fall through to |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
188 ;; expensive state computation. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
189 (vc-rcs-state file)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
190 (vc-rcs-state file))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
191 |
33560 | 192 (defun vc-rcs-workfile-version (file) |
193 "RCS-specific version of `vc-workfile-version'." | |
194 (or (and vc-consult-headers | |
195 (vc-rcs-consult-headers file) | |
196 (vc-file-getprop file 'vc-workfile-version)) | |
197 (progn | |
198 (vc-rcs-fetch-master-state file) | |
199 (vc-file-getprop file 'vc-workfile-version)))) | |
200 | |
201 (defun vc-rcs-latest-on-branch-p (file &optional version) | |
202 "Return non-nil if workfile version of FILE is the latest on its branch. | |
203 When VERSION is given, perform check for that version." | |
204 (unless version (setq version (vc-workfile-version file))) | |
205 (with-temp-buffer | |
206 (string= version | |
207 (if (vc-rcs-trunk-p version) | |
208 (progn | |
209 ;; Compare VERSION to the head version number. | |
210 (vc-insert-file (vc-name file) "^[0-9]") | |
211 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) | |
212 ;; If we are not on the trunk, we need to examine the | |
213 ;; whole current branch. | |
214 (vc-insert-file (vc-name file) "^desc") | |
215 (vc-rcs-find-most-recent-rev (vc-rcs-branch-part version)))))) | |
216 | |
217 (defun vc-rcs-checkout-model (file) | |
218 "RCS-specific version of `vc-checkout-model'." | |
219 (vc-rcs-consult-headers file) | |
220 (or (vc-file-getprop file 'vc-checkout-model) | |
221 (progn (vc-rcs-fetch-master-state file) | |
222 (vc-file-getprop file 'vc-checkout-model)))) | |
223 | |
224 (defun vc-rcs-workfile-unchanged-p (file) | |
225 "RCS-specific implementation of vc-workfile-unchanged-p." | |
226 ;; Try to use rcsdiff --brief. If rcsdiff does not understand that, | |
227 ;; do a double take and remember the fact for the future | |
228 (let* ((version (concat "-r" (vc-workfile-version file))) | |
229 (status (if (eq vc-rcsdiff-knows-brief 'no) | |
230 (vc-do-command nil 1 "rcsdiff" file version) | |
231 (vc-do-command nil 2 "rcsdiff" file "--brief" version)))) | |
232 (if (eq status 2) | |
233 (if (not vc-rcsdiff-knows-brief) | |
234 (setq vc-rcsdiff-knows-brief 'no | |
235 status (vc-do-command nil 1 "rcsdiff" file version)) | |
236 (error "rcsdiff failed")) | |
237 (if (not vc-rcsdiff-knows-brief) (setq vc-rcsdiff-knows-brief 'yes))) | |
238 ;; The workfile is unchanged if rcsdiff found no differences. | |
239 (zerop status))) | |
240 | |
241 | |
242 ;;; | |
243 ;;; State-changing functions | |
244 ;;; | |
245 | |
246 (defun vc-rcs-register (file &optional rev comment) | |
247 "Register FILE into the RCS version-control system. | |
248 REV is the optional revision number for the file. COMMENT can be used | |
249 to provide an initial description of FILE. | |
250 | |
251 `vc-register-switches' and `vc-rcs-register-switches' are passed to | |
252 the RCS command (in that order). | |
253 | |
254 Automatically retrieve a read-only version of the file with keywords | |
255 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." | |
256 (let ((subdir (expand-file-name "RCS" (file-name-directory file))) | |
257 (switches (list | |
258 (if (stringp vc-register-switches) | |
259 (list vc-register-switches) | |
260 vc-register-switches) | |
261 (if (stringp vc-rcs-register-switches) | |
262 (list vc-rcs-register-switches) | |
263 vc-rcs-register-switches)))) | |
264 | |
265 (and (not (file-exists-p subdir)) | |
266 (not (directory-files (file-name-directory file) | |
267 nil ".*,v$" t)) | |
268 (yes-or-no-p "Create RCS subdirectory? ") | |
269 (make-directory subdir)) | |
270 (apply 'vc-do-command nil 0 "ci" file | |
271 ;; if available, use the secure registering option | |
272 (and (vc-rcs-release-p "5.6.4") "-i") | |
273 (concat (if vc-keep-workfiles "-u" "-r") rev) | |
274 (and comment (concat "-t-" comment)) | |
275 switches) | |
276 ;; parse output to find master file name and workfile version | |
277 (with-current-buffer "*vc*" | |
278 (goto-char (point-min)) | |
279 (let ((name (if (looking-at (concat "^\\(.*\\) <-- " | |
280 (file-name-nondirectory file))) | |
281 (match-string 1)))) | |
282 (if (not name) | |
283 ;; if we couldn't find the master name, | |
284 ;; run vc-rcs-registered to get it | |
285 ;; (will be stored into the vc-name property) | |
286 (vc-rcs-registered file) | |
287 (vc-file-setprop file 'vc-name | |
288 (if (file-name-absolute-p name) | |
289 name | |
290 (expand-file-name | |
291 name | |
292 (file-name-directory file)))))) | |
293 (vc-file-setprop file 'vc-workfile-version | |
294 (if (re-search-forward | |
295 "^initial revision: \\([0-9.]+\\).*\n" | |
296 nil t) | |
297 (match-string 1)))))) | |
298 | |
299 (defun vc-rcs-responsible-p (file) | |
300 "Return non-nil if RCS thinks it would be responsible for registering FILE." | |
301 ;; TODO: check for all the patterns in vc-rcs-master-templates | |
302 (file-directory-p (expand-file-name "RCS" (file-name-directory file)))) | |
303 | |
304 (defun vc-rcs-receive-file (file rev) | |
305 "Implementation of receive-file for RCS." | |
306 (let ((checkout-model (vc-checkout-model file))) | |
307 (vc-rcs-register file rev "") | |
308 (when (eq checkout-model 'implicit) | |
309 (vc-rcs-set-non-strict-locking file)) | |
310 (vc-rcs-set-default-branch file (concat rev ".1")))) | |
311 | |
312 (defun vc-rcs-unregister (file) | |
313 "Unregister FILE from RCS. | |
314 If this leaves the RCS subdirectory empty, ask the user | |
315 whether to remove it." | |
316 (let* ((master (vc-name file)) | |
317 (dir (file-name-directory master)) | |
318 (backup-info (find-backup-file-name master))) | |
319 (if (not backup-info) | |
320 (delete-file master) | |
321 (rename-file master (car backup-info) 'ok-if-already-exists) | |
322 (dolist (f (cdr backup-info)) (ignore-errors (delete-file f)))) | |
323 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS") | |
324 ;; check whether RCS dir is empty, i.e. it does not | |
325 ;; contain any files except "." and ".." | |
326 (not (directory-files dir nil | |
327 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*")) | |
328 (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) | |
329 (delete-directory dir)))) | |
330 | |
331 (defun vc-rcs-checkin (file rev comment) | |
332 "RCS-specific version of `vc-backend-checkin'." | |
333 (let ((switches (if (stringp vc-checkin-switches) | |
334 (list vc-checkin-switches) | |
335 vc-checkin-switches))) | |
336 (let ((old-version (vc-workfile-version file)) new-version | |
337 (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) | |
338 ;; Force branch creation if an appropriate | |
339 ;; default branch has been set. | |
340 (and (not rev) | |
341 default-branch | |
342 (string-match (concat "^" (regexp-quote old-version) "\\.") | |
343 default-branch) | |
344 (setq rev default-branch) | |
345 (setq switches (cons "-f" switches))) | |
346 (apply 'vc-do-command nil 0 "ci" (vc-name file) | |
347 ;; if available, use the secure check-in option | |
348 (and (vc-rcs-release-p "5.6.4") "-j") | |
349 (concat (if vc-keep-workfiles "-u" "-r") rev) | |
350 (concat "-m" comment) | |
351 switches) | |
352 (vc-file-setprop file 'vc-workfile-version nil) | |
353 | |
354 ;; determine the new workfile version | |
355 (set-buffer "*vc*") | |
356 (goto-char (point-min)) | |
357 (when (or (re-search-forward | |
358 "new revision: \\([0-9.]+\\);" nil t) | |
359 (re-search-forward | |
360 "reverting to previous revision \\([0-9.]+\\)" nil t)) | |
361 (setq new-version (match-string 1)) | |
362 (vc-file-setprop file 'vc-workfile-version new-version)) | |
363 | |
364 ;; if we got to a different branch, adjust the default | |
365 ;; branch accordingly | |
366 (cond | |
367 ((and old-version new-version | |
368 (not (string= (vc-rcs-branch-part old-version) | |
369 (vc-rcs-branch-part new-version)))) | |
370 (vc-rcs-set-default-branch file | |
371 (if (vc-rcs-trunk-p new-version) nil | |
372 (vc-rcs-branch-part new-version))) | |
373 ;; If this is an old RCS release, we might have | |
374 ;; to remove a remaining lock. | |
375 (if (not (vc-rcs-release-p "5.6.2")) | |
376 ;; exit status of 1 is also accepted. | |
377 ;; It means that the lock was removed before. | |
378 (vc-do-command nil 1 "rcs" (vc-name file) | |
379 (concat "-u" old-version)))))))) | |
380 | |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
381 (defun vc-rcs-checkout (file &optional editable rev workfile) |
33560 | 382 "Retrieve a copy of a saved version of FILE into a workfile." |
383 (let ((filename (or workfile file)) | |
384 (file-buffer (get-file-buffer file)) | |
385 switches) | |
386 (message "Checking out %s..." filename) | |
387 (save-excursion | |
388 ;; Change buffers to get local value of vc-checkout-switches. | |
389 (if file-buffer (set-buffer file-buffer)) | |
390 (setq switches (if (stringp vc-checkout-switches) | |
391 (list vc-checkout-switches) | |
392 vc-checkout-switches)) | |
393 ;; Save this buffer's default-directory | |
394 ;; and use save-excursion to make sure it is restored | |
395 ;; in the same buffer it was saved in. | |
396 (let ((default-directory default-directory)) | |
397 (save-excursion | |
398 ;; Adjust the default-directory so that the check-out creates | |
399 ;; the file in the right place. | |
400 (setq default-directory (file-name-directory filename)) | |
401 (if workfile ;; RCS | |
402 ;; RCS can't check out into arbitrary file names directly. | |
403 ;; Use `co -p' and make stdout point to the correct file. | |
404 (let ((vc-modes (logior (file-modes (vc-name file)) | |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
405 (if editable 128 0))) |
33560 | 406 (failed t)) |
407 (unwind-protect | |
408 (progn | |
409 (let ((coding-system-for-read 'no-conversion) | |
410 (coding-system-for-write 'no-conversion)) | |
411 (with-temp-file filename | |
412 (apply 'vc-do-command | |
413 (current-buffer) 0 "co" (vc-name file) | |
414 "-q" ;; suppress diagnostic output | |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
415 (if editable "-l") |
33560 | 416 (concat "-p" rev) |
417 switches))) | |
418 (set-file-modes filename | |
419 (logior (file-modes (vc-name file)) | |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
420 (if editable 128 0))) |
33560 | 421 (setq failed nil)) |
422 (and failed (file-exists-p filename) | |
423 (delete-file filename)))) | |
424 (let (new-version) | |
425 ;; if we should go to the head of the trunk, | |
426 ;; clear the default branch first | |
427 (and rev (string= rev "") | |
428 (vc-rcs-set-default-branch file nil)) | |
429 ;; now do the checkout | |
430 (apply 'vc-do-command | |
431 nil 0 "co" (vc-name file) | |
432 ;; If locking is not strict, force to overwrite | |
433 ;; the writable workfile. | |
434 (if (eq (vc-checkout-model file) 'implicit) "-f") | |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
435 (if editable "-l") |
33560 | 436 (if rev (concat "-r" rev) |
437 ;; if no explicit revision was specified, | |
438 ;; check out that of the working file | |
439 (let ((workrev (vc-workfile-version file))) | |
440 (if workrev (concat "-r" workrev) | |
441 nil))) | |
442 switches) | |
443 ;; determine the new workfile version | |
444 (with-current-buffer "*vc*" | |
445 (setq new-version | |
446 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1))) | |
447 (vc-file-setprop file 'vc-workfile-version new-version) | |
448 ;; if necessary, adjust the default branch | |
449 (and rev (not (string= rev "")) | |
450 (vc-rcs-set-default-branch | |
451 file | |
452 (if (vc-rcs-latest-on-branch-p file new-version) | |
453 (if (vc-rcs-trunk-p new-version) nil | |
454 (vc-rcs-branch-part new-version)) | |
455 new-version)))))) | |
456 (message "Checking out %s...done" filename))))) | |
457 | |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38436
diff
changeset
|
458 (defun vc-rcs-revert (file &optional contents-done) |
33560 | 459 "Revert FILE to the version it was based on." |
460 (vc-do-command nil 0 "co" (vc-name file) "-f" | |
461 (concat "-u" (vc-workfile-version file)))) | |
462 | |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
463 (defun vc-rcs-cancel-version (file editable) |
33560 | 464 "Undo the most recent checkin of FILE. |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
465 EDITABLE non-nil means previous version should be locked." |
33560 | 466 (let* ((target (vc-workfile-version file)) |
467 (previous (if (vc-trunk-p target) "" (vc-branch-part target))) | |
468 (config (current-window-configuration)) | |
469 (done nil)) | |
470 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target)) | |
471 ;; Check out the most recent remaining version. If it fails, because | |
472 ;; the whole branch got deleted, do a double-take and check out the | |
473 ;; version where the branch started. | |
474 (while (not done) | |
475 (condition-case err | |
476 (progn | |
477 (vc-do-command nil 0 "co" (vc-name file) "-f" | |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
478 (concat (if editable "-l" "-u") previous)) |
33560 | 479 (setq done t)) |
480 (error (set-buffer "*vc*") | |
481 (goto-char (point-min)) | |
482 (if (search-forward "no side branches present for" nil t) | |
483 (progn (setq previous (vc-branch-part previous)) | |
484 (vc-rcs-set-default-branch file previous) | |
485 ;; vc-do-command popped up a window with | |
486 ;; the error message. Get rid of it, by | |
487 ;; restoring the old window configuration. | |
488 (set-window-configuration config)) | |
489 ;; No, it was some other error: re-signal it. | |
490 (signal (car err) (cdr err)))))))) | |
491 | |
492 (defun vc-rcs-merge (file first-version &optional second-version) | |
493 "Merge changes into current working copy of FILE. | |
494 The changes are between FIRST-VERSION and SECOND-VERSION." | |
495 (vc-do-command nil 1 "rcsmerge" (vc-name file) | |
496 "-kk" ; ignore keyword conflicts | |
497 (concat "-r" first-version) | |
498 (if second-version (concat "-r" second-version)))) | |
499 | |
500 (defun vc-rcs-steal-lock (file &optional rev) | |
501 "Steal the lock on the current workfile for FILE and revision REV. | |
502 Needs RCS 5.6.2 or later for -M." | |
503 (vc-do-command nil 0 "rcs" (vc-name file) "-M" | |
504 (concat "-u" rev) (concat "-l" rev))) | |
505 | |
506 | |
507 | |
508 ;;; | |
509 ;;; History functions | |
510 ;;; | |
511 | |
512 (defun vc-rcs-print-log (file) | |
513 "Get change log associated with FILE." | |
36712
551ff6f7ef12
(vc-rcs-print-log): Output to buffer *vc*, not the current buffer.
André Spiegel <spiegel@gnu.org>
parents:
35830
diff
changeset
|
514 (vc-do-command nil 0 "rlog" (vc-name file))) |
33560 | 515 |
516 (defun vc-rcs-show-log-entry (version) | |
517 (when (re-search-forward | |
518 ;; also match some context, for safety | |
519 (concat "----\nrevision " version | |
520 "\\(\tlocked by:.*\n\\|\n\\)date: ") nil t) | |
521 ;; set the display window so that | |
522 ;; the whole log entry is displayed | |
523 (let (start end lines) | |
524 (beginning-of-line) (forward-line -1) (setq start (point)) | |
525 (if (not (re-search-forward "^----*\nrevision" nil t)) | |
526 (setq end (point-max)) | |
527 (beginning-of-line) (forward-line -1) (setq end (point))) | |
528 (setq lines (count-lines start end)) | |
529 (cond | |
530 ;; if the global information and this log entry fit | |
531 ;; into the window, display from the beginning | |
532 ((< (count-lines (point-min) end) (window-height)) | |
533 (goto-char (point-min)) | |
534 (recenter 0) | |
535 (goto-char start)) | |
536 ;; if the whole entry fits into the window, | |
537 ;; display it centered | |
538 ((< (1+ lines) (window-height)) | |
539 (goto-char start) | |
540 (recenter (1- (- (/ (window-height) 2) (/ lines 2))))) | |
541 ;; otherwise (the entry is too large for the window), | |
542 ;; display from the start | |
543 (t | |
544 (goto-char start) | |
545 (recenter 0)))))) | |
546 | |
547 (defun vc-rcs-diff (file &optional oldvers newvers) | |
548 "Get a difference report using RCS between two versions of FILE." | |
549 (if (not oldvers) (setq oldvers (vc-workfile-version file))) | |
36712
551ff6f7ef12
(vc-rcs-print-log): Output to buffer *vc*, not the current buffer.
André Spiegel <spiegel@gnu.org>
parents:
35830
diff
changeset
|
550 (apply 'vc-do-command "*vc-diff*" 1 "rcsdiff" file |
35822
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
551 (append (list "-q" |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
552 (concat "-r" oldvers) |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
553 (and newvers (concat "-r" newvers))) |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
554 (vc-diff-switches-list rcs)))) |
33560 | 555 |
556 | |
557 ;;; | |
558 ;;; Snapshot system | |
559 ;;; | |
560 | |
561 (defun vc-rcs-assign-name (file name) | |
562 "Assign to FILE's latest version a given NAME." | |
563 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-n" name ":"))) | |
564 | |
565 | |
566 ;;; | |
567 ;;; Miscellaneous | |
568 ;;; | |
569 | |
570 (defun vc-rcs-check-headers () | |
571 "Check if the current file has any headers in it." | |
572 (save-excursion | |
573 (goto-char (point-min)) | |
574 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\ | |
575 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t))) | |
576 | |
577 (defun vc-rcs-clear-headers () | |
578 "Implementation of vc-clear-headers for RCS." | |
579 (let ((case-fold-search nil)) | |
580 (goto-char (point-min)) | |
581 (while (re-search-forward | |
582 (concat "\\$\\(Author\\|Date\\|Header\\|Id\\|Locker\\|Name\\|" | |
583 "RCSfile\\|Revision\\|Source\\|State\\): [^$\n]+\\$") | |
584 nil t) | |
585 (replace-match "$\\1$")))) | |
586 | |
587 (defun vc-rcs-rename-file (old new) | |
588 ;; Just move the master file (using vc-rcs-master-templates). | |
589 (vc-rename-master (vc-name old) new vc-rcs-master-templates)) | |
590 | |
591 | |
592 ;;; | |
593 ;;; Internal functions | |
594 ;;; | |
595 | |
596 (defun vc-rcs-trunk-p (rev) | |
597 "Return t if REV is an RCS revision on the trunk." | |
598 (not (eq nil (string-match "\\`[0-9]+\\.[0-9]+\\'" rev)))) | |
599 | |
600 (defun vc-rcs-branch-part (rev) | |
601 "Return the branch part of an RCS revision number REV" | |
602 (substring rev 0 (string-match "\\.[0-9]+\\'" rev))) | |
603 | |
604 (defun vc-rcs-branch-p (rev) | |
605 "Return t if REV is an RCS branch revision" | |
606 (not (eq nil (string-match "\\`[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*\\'" rev)))) | |
607 | |
608 (defun vc-rcs-minor-part (rev) | |
609 "Return the minor version number of an RCS revision number REV." | |
610 (string-match "[0-9]+\\'" rev) | |
611 (substring rev (match-beginning 0) (match-end 0))) | |
612 | |
613 (defun vc-rcs-previous-version (rev) | |
614 "Guess the previous RCS version number" | |
615 (let ((branch (vc-rcs-branch-part rev)) | |
616 (minor-num (string-to-number (vc-rcs-minor-part rev)))) | |
617 (if (> minor-num 1) | |
618 ;; version does probably not start a branch or release | |
619 (concat branch "." (number-to-string (1- minor-num))) | |
620 (if (vc-rcs-trunk-p rev) | |
621 ;; we are at the beginning of the trunk -- | |
622 ;; don't know anything to return here | |
623 "" | |
624 ;; we are at the beginning of a branch -- | |
625 ;; return version of starting point | |
626 (vc-rcs-branch-part branch))))) | |
627 | |
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
628 (defun vc-rcs-workfile-is-newer (file) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
629 "Return non-nil if FILE is newer than its RCS master. |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
630 This likely means that FILE has been changed with respect |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
631 to its master version." |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
632 (let ((file-time (nth 5 (file-attributes file))) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
633 (master-time (nth 5 (file-attributes (vc-name file))))) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
634 (or (> (nth 0 file-time) (nth 0 master-time)) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
635 (and (= (nth 0 file-time) (nth 0 master-time)) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
636 (> (nth 1 file-time) (nth 1 master-time)))))) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
637 |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
638 (defun vc-rcs-find-most-recent-rev (branch) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
639 "Find most recent revision on BRANCH." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
640 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
641 (let ((latest-rev -1) value) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
642 (while (re-search-forward (concat "^\\(" (regexp-quote branch) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
643 "\\.\\([0-9]+\\)\\)\ndate[ \t]+[0-9.]+;") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
644 nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
645 (let ((rev (string-to-number (match-string 2)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
646 (when (< latest-rev rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
647 (setq latest-rev rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
648 (setq value (match-string 1))))) |
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
649 (or value |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
650 (vc-rcs-branch-part branch)))) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
651 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
652 (defun vc-rcs-fetch-master-state (file &optional workfile-version) |
31476 | 653 "Compute the master file's idea of the state of FILE. |
654 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
|
655 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
|
656 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
|
657 `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
|
658 file." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
659 (with-temp-buffer |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
660 (vc-insert-file (vc-name file) "^[0-9]") |
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
661 (let ((workfile-is-latest nil) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
662 (default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1))) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
663 (vc-file-setprop file 'vc-rcs-default-branch default-branch) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
664 (unless workfile-version |
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
665 ;; Workfile version not known yet. Determine that first. It |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
666 ;; is either the head of the trunk, the head of the default |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
667 ;; branch, or the "default branch" itself, if that is a full |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
668 ;; revision number. |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
669 (cond |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
670 ;; no default branch |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
671 ((or (not default-branch) (string= "" default-branch)) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
672 (setq workfile-version |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
673 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
674 (setq workfile-is-latest t)) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
675 ;; default branch is actually a revision |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
676 ((string-match "^[0-9]+\\.[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*$" |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
677 default-branch) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
678 (setq workfile-version default-branch)) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
679 ;; else, search for the head of the default branch |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
680 (t (vc-insert-file (vc-name file) "^desc") |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
681 (setq workfile-version |
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
682 (vc-rcs-find-most-recent-rev default-branch)) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
683 (setq workfile-is-latest t))) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
684 (vc-file-setprop file 'vc-workfile-version workfile-version)) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
685 ;; Check strict locking |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
686 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
687 (vc-file-setprop file 'vc-checkout-model |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
688 (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
|
689 'locking 'implicit)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
690 ;; Compute state of workfile version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
691 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
692 (let ((locking-user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
693 (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
|
694 (regexp-quote workfile-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
695 "[^0-9.]") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
696 1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
697 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
698 ;; not locked |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
699 ((not locking-user) |
31476 | 700 (if (or workfile-is-latest |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
701 (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
|
702 ;; workfile version is latest on branch |
33610
32bcc6e27e02
(vc-rcs-state): Call vc-workfile-unchanged-p only here, and
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
703 'up-to-date |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
704 ;; workfile version is not latest on branch |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
705 'needs-patch)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
706 ;; locked by the calling user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
707 ((and (stringp locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
708 (string= locking-user (vc-user-login-name))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
709 (if (or (eq (vc-checkout-model file) 'locking) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
710 workfile-is-latest |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
711 (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
|
712 'edited |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
713 ;; 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
|
714 ;; 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
|
715 ;; 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
|
716 ;; to use `needs-merge' in this case. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
717 'needs-merge)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
718 ;; locked by somebody else |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
719 ((stringp locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
720 locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
721 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
722 (error "Error getting state of RCS file"))))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
723 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
724 (defun vc-rcs-consult-headers (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
725 "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
|
726 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
727 Returns: nil if no headers were found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
728 'rev if a workfile revision was found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
729 '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
|
730 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
731 ((not (get-file-buffer file)) nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
732 ((let (status version locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
733 (save-excursion |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
734 (set-buffer (get-file-buffer file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
735 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
736 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
737 ;; search for $Id or $Header |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
738 ;; ------------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
739 ;; 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
|
740 ((or (and (search-forward "$Id\ : " nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
741 (looking-at "[^ ]+ \\([0-9.]+\\) ")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
742 (and (progn (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
743 (search-forward "$Header\ : " nil t)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
744 (looking-at "[^ ]+ \\([0-9.]+\\) "))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
745 (goto-char (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
746 ;; if found, store the revision number ... |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
747 (setq version (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
748 ;; ... and check for the locking state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
749 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
750 ((looking-at |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
751 (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
|
752 "[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
|
753 "[^ ]+ [^ ]+ ")) ; author & state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
754 (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
|
755 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
756 ;; unlocked revision |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
757 ((looking-at "\\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
758 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
759 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
760 ;; revision is locked by some user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
761 ((looking-at "\\([^ ]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
762 (setq locking-user (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
763 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
764 ;; everything else: false |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
765 (nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
766 ;; unexpected information in |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
767 ;; keyword string --> quit |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
768 (nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
769 ;; search for $Revision |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
770 ;; -------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
771 ((re-search-forward (concat "\\$" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
772 "Revision: \\([0-9.]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
773 nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
774 ;; if found, store the revision number ... |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
775 (setq version (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
776 ;; and see if there's any lock information |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
777 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
778 (if (re-search-forward (concat "\\$" "Locker:") nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
779 (cond ((looking-at " \\([^ ]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
780 (setq locking-user (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
781 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
782 ((looking-at " *\\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
783 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
784 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
785 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
786 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
787 (setq status 'rev-and-lock))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
788 (setq status 'rev))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
789 ;; else: nothing found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
790 ;; ------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
791 (t nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
792 (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
|
793 (and (eq status 'rev-and-lock) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
794 (vc-file-setprop file 'vc-state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
795 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
796 ((eq locking-user 'none) 'up-to-date) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
797 ((string= locking-user (vc-user-login-name)) 'edited) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
798 (t locking-user))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
799 ;; 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
|
800 ;; master file, because that would eliminate all the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
801 ;; performance gain the headers brought us. We therefore |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
802 ;; 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
|
803 ;; 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
|
804 ;; 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
|
805 ;; 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
|
806 ;; locking is not used. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
807 (not (vc-mistrust-permissions file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
808 (vc-up-to-date-p file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
809 (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
|
810 (vc-file-setprop file 'vc-checkout-model 'locking) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
811 (vc-file-setprop file 'vc-checkout-model 'implicit))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
812 status)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
813 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
814 (defun vc-release-greater-or-equal (r1 r2) |
31476 | 815 "Compare release numbers, represented as strings. |
816 Release components are assumed cardinal numbers, not decimal fractions | |
817 \(5.10 is a higher release than 5.9\). Omitted fields are considered | |
818 lower \(5.6.7 is earlier than 5.6.7.1\). Comparison runs till the end | |
819 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
|
820 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
|
821 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
|
822 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
|
823 (let (v1 v2 i1 i2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
824 (catch 'done |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
825 (or (and (string-match "^\\.?\\([0-9]+\\)" r1) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
826 (setq i1 (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
827 (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
|
828 (or (and (string-match "^\\.?\\([0-9]+\\)" r2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
829 (setq i2 (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
830 (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
|
831 (if (> v1 v2) (throw 'done t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
832 (if (< v1 v2) (throw 'done nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
833 (throw 'done |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
834 (vc-release-greater-or-equal |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
835 (substring r1 i1) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
836 (substring r2 i2))))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
837 (throw 'done t))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
838 (or (and (string-match "^\\.?\\([0-9]+\\)" r2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
839 (throw 'done nil)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
840 (throw 'done t))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
841 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
842 (defun vc-rcs-release-p (release) |
31476 | 843 "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
|
844 (let ((installation (vc-rcs-system-release))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
845 (if (and installation |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
846 (not (eq installation 'unknown))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
847 (vc-release-greater-or-equal installation release)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
848 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
849 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
850 (defun vc-rcs-system-release () |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
851 "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
|
852 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
|
853 override this using variable `vc-rcs-release'. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
854 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
855 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
|
856 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
|
857 (or vc-rcs-release |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
858 (setq vc-rcs-release |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
859 (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
|
860 (with-current-buffer (get-buffer "*vc*") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
861 (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
862 'unknown)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
863 |
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
864 (defun vc-rcs-set-non-strict-locking (file) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
865 (vc-do-command nil 0 "rcs" file "-U") |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
866 (vc-file-setprop file 'vc-checkout-model 'implicit) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
867 (set-file-modes file (logior (file-modes file) 128))) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
868 |
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
869 (defun vc-rcs-set-default-branch (file branch) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
870 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-b" branch)) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
871 (vc-file-setprop file 'vc-rcs-default-branch branch)) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
872 |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
873 (provide 'vc-rcs) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
874 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
875 ;;; vc-rcs.el ends here |