Mercurial > emacs
annotate lisp/vc-rcs.el @ 54736:b94de166de9d
(ethio-sera-being-called-by-w3): New
variable.
(ethio-sera-to-fidel-ethio): Check ethio-sera-being-called-by-w3
instead of sera-being-called-by-w3.
(ethio-fidel-to-sera-buffer): Likewise.
(ethio-find-file): Bind ethio-sera-being-called-by-w3 to t
instead of sera-being-called-by-w3.
(ethio-write-file): Likewise.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Mon, 05 Apr 2004 23:27:37 +0000 |
| parents | 37e95eddf2e8 |
| children | b9c0ed2a46bd 108bb5537c12 |
| 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 |
|
54466
37e95eddf2e8
(vc-rcs-print-log, vc-rcs-diff): Add optional BUFFER argument.
Andr? Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
8 ;; $Id: vc-rcs.el,v 1.38 2003/09/01 15:45:17 miles 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 |
|
35822
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
61 (defcustom vc-rcs-diff-switches nil |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
62 "*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
|
63 :type '(choice (const :tag "None" nil) |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
64 (string :tag "Argument String") |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
65 (repeat :tag "Argument List" |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
66 :value ("") |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
67 string)) |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
68 :version "21.1" |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
69 :group 'vc) |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
70 |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
71 (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
|
72 "*Header keywords to be inserted by `vc-insert-headers'." |
| 35178 | 73 :type '(repeat string) |
| 31476 | 74 :version "21.1" |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
75 :group 'vc) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
76 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
77 (defcustom vc-rcsdiff-knows-brief nil |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
78 "*Indicates whether rcsdiff understands the --brief option. |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
79 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
|
80 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
|
81 :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
|
82 :group 'vc) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
83 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
84 ;;;###autoload |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
85 (defcustom vc-rcs-master-templates |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
86 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
87 "*Where to look for RCS master files. |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
88 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
|
89 :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
|
90 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
91 (repeat :tag "User-specified" |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
92 (choice string |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
93 function))) |
| 31476 | 94 :version "21.1" |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
95 :group 'vc) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
96 |
| 33560 | 97 |
| 98 ;;; | |
| 99 ;;; State-querying functions | |
| 100 ;;; | |
| 101 | |
|
48282
0cae7bc9a8b8
(vc-rcs-registered): Improve comment.
Andr? Spiegel <spiegel@gnu.org>
parents:
48263
diff
changeset
|
102 ;;; The autoload cookie below places vc-rcs-registered directly into |
|
0cae7bc9a8b8
(vc-rcs-registered): Improve comment.
Andr? Spiegel <spiegel@gnu.org>
parents:
48263
diff
changeset
|
103 ;;; loaddefs.el, so that vc-rcs.el does not need to be loaded for |
|
0cae7bc9a8b8
(vc-rcs-registered): Improve comment.
Andr? Spiegel <spiegel@gnu.org>
parents:
48263
diff
changeset
|
104 ;;; every file that is visited. The definition is repeated below |
|
0cae7bc9a8b8
(vc-rcs-registered): Improve comment.
Andr? Spiegel <spiegel@gnu.org>
parents:
48263
diff
changeset
|
105 ;;; so that Help and etags can find it. |
|
0cae7bc9a8b8
(vc-rcs-registered): Improve comment.
Andr? Spiegel <spiegel@gnu.org>
parents:
48263
diff
changeset
|
106 |
|
0cae7bc9a8b8
(vc-rcs-registered): Improve comment.
Andr? Spiegel <spiegel@gnu.org>
parents:
48263
diff
changeset
|
107 ;;;###autoload (defun vc-rcs-registered (f) (vc-default-registered 'RCS f)) |
|
48263
b05233e8524d
(vc-rcs-registered): Handle the autoload cookie so that the definition
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47805
diff
changeset
|
108 (defun vc-rcs-registered (f) (vc-default-registered 'RCS f)) |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
109 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
110 (defun vc-rcs-state (file) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
111 "Implementation of `vc-state' for RCS." |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
112 (or (boundp 'vc-rcs-headers-result) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
113 (and vc-consult-headers |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
114 (vc-rcs-consult-headers file))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
115 (let ((state |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
116 ;; 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
|
117 ;; 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
|
118 ;; handle that. |
| 31476 | 119 (vc-rcs-fetch-master-state file |
| 120 (vc-file-getprop file | |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
121 '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
|
122 (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
|
123 state |
|
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
Andr? Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
124 (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
|
125 'up-to-date |
|
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
Andr? Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
126 (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
|
127 'unlocked-changes |
|
2c1708b98891
(vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
Andr? Spiegel <spiegel@gnu.org>
parents:
33610
diff
changeset
|
128 'edited))))) |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
129 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
130 (defun vc-rcs-state-heuristic (file) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
131 "State heuristic for RCS." |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
132 (let (vc-rcs-headers-result) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
133 (if (and vc-consult-headers |
| 31476 | 134 (setq vc-rcs-headers-result |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
135 (vc-rcs-consult-headers file)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
136 (eq vc-rcs-headers-result 'rev-and-lock)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
137 (let ((state (vc-file-getprop file 'vc-state))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
138 ;; 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
|
139 ;; 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
|
140 ;; the file or not. |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
141 (if (and (eq state 'up-to-date) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
142 (not (vc-mistrust-permissions file))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
143 (cond |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
144 ((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
|
145 (vc-file-setprop file 'vc-checkout-model 'implicit) |
|
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
146 (setq state |
|
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
147 (if (vc-rcs-workfile-is-newer file) |
|
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
148 'edited |
|
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
149 'up-to-date))) |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
150 ((string-match ".r-..-..-." (nth 8 (file-attributes file))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
151 (vc-file-setprop file 'vc-checkout-model 'locking)))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
152 state) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
153 (if (not (vc-mistrust-permissions file)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
154 (let* ((attributes (file-attributes file)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
155 (owner-uid (nth 2 attributes)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
156 (permissions (nth 8 attributes))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
157 (cond ((string-match ".r-..-..-." permissions) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
158 (vc-file-setprop file 'vc-checkout-model 'locking) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
159 'up-to-date) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
160 ((string-match ".rw..-..-." permissions) |
|
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
161 (if (eq (vc-checkout-model file) 'locking) |
|
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
162 (if (file-ownership-preserved-p file) |
|
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
163 'edited |
|
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
164 (vc-user-login-name owner-uid)) |
|
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
165 (if (vc-rcs-workfile-is-newer file) |
|
31809
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 (t |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
169 ;; Strange permissions. Fall through to |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
170 ;; expensive state computation. |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
171 (vc-rcs-state file)))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
172 (vc-rcs-state file))))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
173 |
| 33560 | 174 (defun vc-rcs-workfile-version (file) |
| 175 "RCS-specific version of `vc-workfile-version'." | |
| 176 (or (and vc-consult-headers | |
| 177 (vc-rcs-consult-headers file) | |
| 178 (vc-file-getprop file 'vc-workfile-version)) | |
| 179 (progn | |
| 180 (vc-rcs-fetch-master-state file) | |
| 181 (vc-file-getprop file 'vc-workfile-version)))) | |
| 182 | |
| 183 (defun vc-rcs-latest-on-branch-p (file &optional version) | |
| 184 "Return non-nil if workfile version of FILE is the latest on its branch. | |
| 185 When VERSION is given, perform check for that version." | |
| 186 (unless version (setq version (vc-workfile-version file))) | |
| 187 (with-temp-buffer | |
| 188 (string= version | |
|
42549
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
189 (if (vc-trunk-p version) |
| 33560 | 190 (progn |
| 191 ;; Compare VERSION to the head version number. | |
| 192 (vc-insert-file (vc-name file) "^[0-9]") | |
| 193 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) | |
| 194 ;; If we are not on the trunk, we need to examine the | |
| 195 ;; whole current branch. | |
| 196 (vc-insert-file (vc-name file) "^desc") | |
|
42549
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
197 (vc-rcs-find-most-recent-rev (vc-branch-part version)))))) |
| 33560 | 198 |
| 199 (defun vc-rcs-checkout-model (file) | |
| 200 "RCS-specific version of `vc-checkout-model'." | |
| 201 (vc-rcs-consult-headers file) | |
| 202 (or (vc-file-getprop file 'vc-checkout-model) | |
| 203 (progn (vc-rcs-fetch-master-state file) | |
| 204 (vc-file-getprop file 'vc-checkout-model)))) | |
| 205 | |
| 206 (defun vc-rcs-workfile-unchanged-p (file) | |
| 207 "RCS-specific implementation of vc-workfile-unchanged-p." | |
| 208 ;; Try to use rcsdiff --brief. If rcsdiff does not understand that, | |
| 209 ;; do a double take and remember the fact for the future | |
| 210 (let* ((version (concat "-r" (vc-workfile-version file))) | |
| 211 (status (if (eq vc-rcsdiff-knows-brief 'no) | |
| 212 (vc-do-command nil 1 "rcsdiff" file version) | |
| 213 (vc-do-command nil 2 "rcsdiff" file "--brief" version)))) | |
| 214 (if (eq status 2) | |
| 215 (if (not vc-rcsdiff-knows-brief) | |
| 216 (setq vc-rcsdiff-knows-brief 'no | |
| 217 status (vc-do-command nil 1 "rcsdiff" file version)) | |
| 218 (error "rcsdiff failed")) | |
| 219 (if (not vc-rcsdiff-knows-brief) (setq vc-rcsdiff-knows-brief 'yes))) | |
| 220 ;; The workfile is unchanged if rcsdiff found no differences. | |
| 221 (zerop status))) | |
| 222 | |
| 223 | |
| 224 ;;; | |
| 225 ;;; State-changing functions | |
| 226 ;;; | |
| 227 | |
| 228 (defun vc-rcs-register (file &optional rev comment) | |
| 229 "Register FILE into the RCS version-control system. | |
| 230 REV is the optional revision number for the file. COMMENT can be used | |
| 231 to provide an initial description of FILE. | |
| 232 | |
| 233 `vc-register-switches' and `vc-rcs-register-switches' are passed to | |
| 234 the RCS command (in that order). | |
| 235 | |
| 236 Automatically retrieve a read-only version of the file with keywords | |
| 237 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." | |
|
50903
c03b80e1bacd
(vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
238 (let ((subdir (expand-file-name "RCS" (file-name-directory file)))) |
| 33560 | 239 (and (not (file-exists-p subdir)) |
| 240 (not (directory-files (file-name-directory file) | |
| 241 nil ".*,v$" t)) | |
| 242 (yes-or-no-p "Create RCS subdirectory? ") | |
| 243 (make-directory subdir)) | |
| 244 (apply 'vc-do-command nil 0 "ci" file | |
| 245 ;; if available, use the secure registering option | |
| 246 (and (vc-rcs-release-p "5.6.4") "-i") | |
| 247 (concat (if vc-keep-workfiles "-u" "-r") rev) | |
| 248 (and comment (concat "-t-" comment)) | |
|
50903
c03b80e1bacd
(vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
249 (vc-switches 'RCS 'register)) |
| 33560 | 250 ;; parse output to find master file name and workfile version |
| 251 (with-current-buffer "*vc*" | |
| 252 (goto-char (point-min)) | |
| 253 (let ((name (if (looking-at (concat "^\\(.*\\) <-- " | |
| 254 (file-name-nondirectory file))) | |
| 255 (match-string 1)))) | |
| 256 (if (not name) | |
| 257 ;; if we couldn't find the master name, | |
| 258 ;; run vc-rcs-registered to get it | |
| 259 ;; (will be stored into the vc-name property) | |
| 260 (vc-rcs-registered file) | |
| 261 (vc-file-setprop file 'vc-name | |
| 262 (if (file-name-absolute-p name) | |
| 263 name | |
| 264 (expand-file-name | |
| 265 name | |
| 266 (file-name-directory file)))))) | |
| 267 (vc-file-setprop file 'vc-workfile-version | |
| 268 (if (re-search-forward | |
| 269 "^initial revision: \\([0-9.]+\\).*\n" | |
| 270 nil t) | |
| 271 (match-string 1)))))) | |
| 272 | |
| 273 (defun vc-rcs-responsible-p (file) | |
| 274 "Return non-nil if RCS thinks it would be responsible for registering FILE." | |
| 275 ;; TODO: check for all the patterns in vc-rcs-master-templates | |
| 276 (file-directory-p (expand-file-name "RCS" (file-name-directory file)))) | |
| 277 | |
| 278 (defun vc-rcs-receive-file (file rev) | |
| 279 "Implementation of receive-file for RCS." | |
| 280 (let ((checkout-model (vc-checkout-model file))) | |
| 281 (vc-rcs-register file rev "") | |
| 282 (when (eq checkout-model 'implicit) | |
| 283 (vc-rcs-set-non-strict-locking file)) | |
| 284 (vc-rcs-set-default-branch file (concat rev ".1")))) | |
| 285 | |
| 286 (defun vc-rcs-unregister (file) | |
| 287 "Unregister FILE from RCS. | |
| 288 If this leaves the RCS subdirectory empty, ask the user | |
| 289 whether to remove it." | |
| 290 (let* ((master (vc-name file)) | |
| 291 (dir (file-name-directory master)) | |
| 292 (backup-info (find-backup-file-name master))) | |
| 293 (if (not backup-info) | |
| 294 (delete-file master) | |
| 295 (rename-file master (car backup-info) 'ok-if-already-exists) | |
| 296 (dolist (f (cdr backup-info)) (ignore-errors (delete-file f)))) | |
| 297 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS") | |
| 298 ;; check whether RCS dir is empty, i.e. it does not | |
| 299 ;; contain any files except "." and ".." | |
|
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
300 (not (directory-files dir nil |
| 33560 | 301 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*")) |
| 302 (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) | |
| 303 (delete-directory dir)))) | |
| 304 | |
| 305 (defun vc-rcs-checkin (file rev comment) | |
| 306 "RCS-specific version of `vc-backend-checkin'." | |
|
50903
c03b80e1bacd
(vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
307 (let ((switches (vc-switches 'RCS 'checkin))) |
| 33560 | 308 (let ((old-version (vc-workfile-version file)) new-version |
| 309 (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) | |
|
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
310 ;; Force branch creation if an appropriate |
| 33560 | 311 ;; default branch has been set. |
| 312 (and (not rev) | |
| 313 default-branch | |
| 314 (string-match (concat "^" (regexp-quote old-version) "\\.") | |
| 315 default-branch) | |
| 316 (setq rev default-branch) | |
| 317 (setq switches (cons "-f" switches))) | |
|
48969
8a48bb5e7e5b
(vc-rcs-checkin): By default, always specify the
Andr? Spiegel <spiegel@gnu.org>
parents:
48966
diff
changeset
|
318 (if (and (not rev) old-version) |
|
8a48bb5e7e5b
(vc-rcs-checkin): By default, always specify the
Andr? Spiegel <spiegel@gnu.org>
parents:
48966
diff
changeset
|
319 (setq rev (vc-branch-part old-version))) |
| 33560 | 320 (apply 'vc-do-command nil 0 "ci" (vc-name file) |
| 321 ;; if available, use the secure check-in option | |
| 322 (and (vc-rcs-release-p "5.6.4") "-j") | |
| 323 (concat (if vc-keep-workfiles "-u" "-r") rev) | |
| 324 (concat "-m" comment) | |
| 325 switches) | |
| 326 (vc-file-setprop file 'vc-workfile-version nil) | |
| 327 | |
| 328 ;; determine the new workfile version | |
| 329 (set-buffer "*vc*") | |
| 330 (goto-char (point-min)) | |
| 331 (when (or (re-search-forward | |
| 332 "new revision: \\([0-9.]+\\);" nil t) | |
| 333 (re-search-forward | |
| 334 "reverting to previous revision \\([0-9.]+\\)" nil t)) | |
| 335 (setq new-version (match-string 1)) | |
| 336 (vc-file-setprop file 'vc-workfile-version new-version)) | |
| 337 | |
| 338 ;; if we got to a different branch, adjust the default | |
| 339 ;; branch accordingly | |
| 340 (cond | |
| 341 ((and old-version new-version | |
|
42549
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
342 (not (string= (vc-branch-part old-version) |
|
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
343 (vc-branch-part new-version)))) |
|
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
344 (vc-rcs-set-default-branch file |
|
42549
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
345 (if (vc-trunk-p new-version) nil |
|
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
346 (vc-branch-part new-version))) |
| 33560 | 347 ;; If this is an old RCS release, we might have |
| 348 ;; to remove a remaining lock. | |
| 349 (if (not (vc-rcs-release-p "5.6.2")) | |
| 350 ;; exit status of 1 is also accepted. | |
| 351 ;; It means that the lock was removed before. | |
| 352 (vc-do-command nil 1 "rcs" (vc-name file) | |
| 353 (concat "-u" old-version)))))))) | |
| 354 | |
|
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
355 (defun vc-rcs-find-version (file rev buffer) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
356 (apply 'vc-do-command |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
357 buffer 0 "co" (vc-name file) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
358 "-q" ;; suppress diagnostic output |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
359 (concat "-p" rev) |
|
50903
c03b80e1bacd
(vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
360 (vc-switches 'RCS 'checkout))) |
|
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
361 |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
362 (defun vc-rcs-checkout (file &optional editable rev) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
363 "Retrieve a copy of a saved version of FILE." |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
364 (let ((file-buffer (get-file-buffer file)) |
| 33560 | 365 switches) |
|
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
366 (message "Checking out %s..." file) |
| 33560 | 367 (save-excursion |
| 368 ;; Change buffers to get local value of vc-checkout-switches. | |
| 369 (if file-buffer (set-buffer file-buffer)) | |
|
50903
c03b80e1bacd
(vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
370 (setq switches (vc-switches 'RCS 'checkout)) |
| 33560 | 371 ;; Save this buffer's default-directory |
| 372 ;; and use save-excursion to make sure it is restored | |
| 373 ;; in the same buffer it was saved in. | |
| 374 (let ((default-directory default-directory)) | |
| 375 (save-excursion | |
| 376 ;; Adjust the default-directory so that the check-out creates | |
| 377 ;; the file in the right place. | |
|
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
378 (setq default-directory (file-name-directory file)) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
379 (let (new-version) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
380 ;; if we should go to the head of the trunk, |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
381 ;; clear the default branch first |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
382 (and rev (string= rev "") |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
383 (vc-rcs-set-default-branch file nil)) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
384 ;; now do the checkout |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
385 (apply 'vc-do-command |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
386 nil 0 "co" (vc-name file) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
387 ;; If locking is not strict, force to overwrite |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
388 ;; the writable workfile. |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
389 (if (eq (vc-checkout-model file) 'implicit) "-f") |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
390 (if editable "-l") |
|
48966
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
391 (if (stringp rev) |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
392 ;; a literal revision was specified |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
393 (concat "-r" rev) |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
394 (let ((workrev (vc-workfile-version file))) |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
395 (if workrev |
|
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
396 (concat "-r" |
|
48966
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
397 (if (not rev) |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
398 ;; no revision specified: |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
399 ;; use current workfile version |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
400 workrev |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
401 ;; REV is t ... |
|
49092
da6da3a685c2
(vc-rcs-checkout): Fix the check whether we are on a branch.
Andr? Spiegel <spiegel@gnu.org>
parents:
49021
diff
changeset
|
402 (if (not (vc-trunk-p workrev)) |
|
48966
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
403 ;; ... go to head of current branch |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
404 (vc-branch-part workrev) |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
405 ;; ... go to head of trunk |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
406 (vc-rcs-set-default-branch file |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
407 nil) |
|
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
Andr? Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
408 "")))))) |
|
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
409 switches) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
410 ;; determine the new workfile version |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
411 (with-current-buffer "*vc*" |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
412 (setq new-version |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
413 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1))) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
414 (vc-file-setprop file 'vc-workfile-version new-version) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
415 ;; if necessary, adjust the default branch |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
416 (and rev (not (string= rev "")) |
|
50903
c03b80e1bacd
(vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
417 (vc-rcs-set-default-branch |
|
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
418 file |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
419 (if (vc-rcs-latest-on-branch-p file new-version) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
420 (if (vc-trunk-p new-version) nil |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
421 (vc-branch-part new-version)) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
422 new-version))))) |
|
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
423 (message "Checking out %s...done" file))))) |
| 33560 | 424 |
|
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
Andr? Spiegel <spiegel@gnu.org>
parents:
38436
diff
changeset
|
425 (defun vc-rcs-revert (file &optional contents-done) |
| 33560 | 426 "Revert FILE to the version it was based on." |
| 427 (vc-do-command nil 0 "co" (vc-name file) "-f" | |
|
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
428 (concat (if (eq (vc-state file) 'edited) "-u" "-r") |
|
49021
f5b3c92f968b
(vc-rcs-revert): Unlock only if the user does have the lock.
Andr? Spiegel <spiegel@gnu.org>
parents:
48969
diff
changeset
|
429 (vc-workfile-version file)))) |
| 33560 | 430 |
|
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
Andr? Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
431 (defun vc-rcs-cancel-version (file editable) |
| 33560 | 432 "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
|
433 EDITABLE non-nil means previous version should be locked." |
| 33560 | 434 (let* ((target (vc-workfile-version file)) |
| 435 (previous (if (vc-trunk-p target) "" (vc-branch-part target))) | |
| 436 (config (current-window-configuration)) | |
| 437 (done nil)) | |
| 438 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target)) | |
| 439 ;; Check out the most recent remaining version. If it fails, because | |
| 440 ;; the whole branch got deleted, do a double-take and check out the | |
| 441 ;; version where the branch started. | |
| 442 (while (not done) | |
| 443 (condition-case err | |
| 444 (progn | |
| 445 (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
|
446 (concat (if editable "-l" "-u") previous)) |
| 33560 | 447 (setq done t)) |
| 448 (error (set-buffer "*vc*") | |
| 449 (goto-char (point-min)) | |
| 450 (if (search-forward "no side branches present for" nil t) | |
| 451 (progn (setq previous (vc-branch-part previous)) | |
| 452 (vc-rcs-set-default-branch file previous) | |
| 453 ;; vc-do-command popped up a window with | |
| 454 ;; the error message. Get rid of it, by | |
| 455 ;; restoring the old window configuration. | |
| 456 (set-window-configuration config)) | |
| 457 ;; No, it was some other error: re-signal it. | |
| 458 (signal (car err) (cdr err)))))))) | |
| 459 | |
| 460 (defun vc-rcs-merge (file first-version &optional second-version) | |
| 461 "Merge changes into current working copy of FILE. | |
| 462 The changes are between FIRST-VERSION and SECOND-VERSION." | |
| 463 (vc-do-command nil 1 "rcsmerge" (vc-name file) | |
| 464 "-kk" ; ignore keyword conflicts | |
| 465 (concat "-r" first-version) | |
| 466 (if second-version (concat "-r" second-version)))) | |
| 467 | |
| 468 (defun vc-rcs-steal-lock (file &optional rev) | |
| 469 "Steal the lock on the current workfile for FILE and revision REV. | |
| 470 Needs RCS 5.6.2 or later for -M." | |
|
42549
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
471 (vc-do-command nil 0 "rcs" (vc-name file) "-M" (concat "-u" rev)) |
|
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
472 ;; Do a real checkout after stealing the lock, so that we see |
|
42549
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
473 ;; expanded headers. |
|
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
474 (vc-do-command nil 0 "co" (vc-name file) "-f" (concat "-l" rev))) |
| 33560 | 475 |
| 476 | |
| 477 | |
| 478 ;;; | |
| 479 ;;; History functions | |
| 480 ;;; | |
| 481 | |
|
54466
37e95eddf2e8
(vc-rcs-print-log, vc-rcs-diff): Add optional BUFFER argument.
Andr? Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
482 (defun vc-rcs-print-log (file &optional buffer) |
| 33560 | 483 "Get change log associated with FILE." |
|
54466
37e95eddf2e8
(vc-rcs-print-log, vc-rcs-diff): Add optional BUFFER argument.
Andr? Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
484 (vc-do-command buffer 0 "rlog" (vc-name file))) |
| 33560 | 485 |
|
54466
37e95eddf2e8
(vc-rcs-print-log, vc-rcs-diff): Add optional BUFFER argument.
Andr? Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
486 (defun vc-rcs-diff (file &optional oldvers newvers buffer) |
| 33560 | 487 "Get a difference report using RCS between two versions of FILE." |
| 488 (if (not oldvers) (setq oldvers (vc-workfile-version file))) | |
|
54466
37e95eddf2e8
(vc-rcs-print-log, vc-rcs-diff): Add optional BUFFER argument.
Andr? Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
489 (apply 'vc-do-command (or buffer "*vc-diff*") 1 "rcsdiff" file |
|
35822
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
490 (append (list "-q" |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
491 (concat "-r" oldvers) |
|
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
Andr? Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
492 (and newvers (concat "-r" newvers))) |
|
50903
c03b80e1bacd
(vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
493 (vc-switches 'RCS 'diff)))) |
| 33560 | 494 |
| 495 | |
| 496 ;;; | |
| 497 ;;; Snapshot system | |
| 498 ;;; | |
| 499 | |
| 500 (defun vc-rcs-assign-name (file name) | |
| 501 "Assign to FILE's latest version a given NAME." | |
| 502 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-n" name ":"))) | |
| 503 | |
| 504 | |
| 505 ;;; | |
| 506 ;;; Miscellaneous | |
| 507 ;;; | |
| 508 | |
| 509 (defun vc-rcs-check-headers () | |
| 510 "Check if the current file has any headers in it." | |
| 511 (save-excursion | |
| 512 (goto-char (point-min)) | |
| 513 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\ | |
| 514 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t))) | |
| 515 | |
| 516 (defun vc-rcs-clear-headers () | |
| 517 "Implementation of vc-clear-headers for RCS." | |
| 518 (let ((case-fold-search nil)) | |
| 519 (goto-char (point-min)) | |
| 520 (while (re-search-forward | |
| 521 (concat "\\$\\(Author\\|Date\\|Header\\|Id\\|Locker\\|Name\\|" | |
| 522 "RCSfile\\|Revision\\|Source\\|State\\): [^$\n]+\\$") | |
| 523 nil t) | |
| 524 (replace-match "$\\1$")))) | |
| 525 | |
| 526 (defun vc-rcs-rename-file (old new) | |
| 527 ;; Just move the master file (using vc-rcs-master-templates). | |
| 528 (vc-rename-master (vc-name old) new vc-rcs-master-templates)) | |
| 529 | |
| 530 | |
| 531 ;;; | |
| 532 ;;; Internal functions | |
| 533 ;;; | |
| 534 | |
|
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
535 (defun vc-rcs-workfile-is-newer (file) |
|
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
536 "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
|
537 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
|
538 to its master version." |
|
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
539 (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
|
540 (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
|
541 (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
|
542 (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
|
543 (> (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
|
544 |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
545 (defun vc-rcs-find-most-recent-rev (branch) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
546 "Find most recent revision on BRANCH." |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
547 (goto-char (point-min)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
548 (let ((latest-rev -1) value) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
549 (while (re-search-forward (concat "^\\(" (regexp-quote branch) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
550 "\\.\\([0-9]+\\)\\)\ndate[ \t]+[0-9.]+;") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
551 nil t) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
552 (let ((rev (string-to-number (match-string 2)))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
553 (when (< latest-rev rev) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
554 (setq latest-rev rev) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
555 (setq value (match-string 1))))) |
|
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
556 (or value |
|
42549
6301bb6ec388
(vc-rcs-steal-lock): Do a real checkout after stealing the lock, so
Andr? Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
557 (vc-branch-part branch)))) |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
558 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
559 (defun vc-rcs-fetch-master-state (file &optional workfile-version) |
| 31476 | 560 "Compute the master file's idea of the state of FILE. |
| 561 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
|
562 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
|
563 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
|
564 `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
|
565 file." |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
566 (with-temp-buffer |
|
46543
7fa004ccd462
(vc-rcs-fetch-master-state): Be more careful to check
Andr? Spiegel <spiegel@gnu.org>
parents:
44004
diff
changeset
|
567 (if (or (not (vc-insert-file (vc-name file) "^[0-9]")) |
|
7fa004ccd462
(vc-rcs-fetch-master-state): Be more careful to check
Andr? Spiegel <spiegel@gnu.org>
parents:
44004
diff
changeset
|
568 (progn (goto-char (point-min)) |
|
7fa004ccd462
(vc-rcs-fetch-master-state): Be more careful to check
Andr? Spiegel <spiegel@gnu.org>
parents:
44004
diff
changeset
|
569 (not (looking-at "^head[ \t\n]+[^;]+;$")))) |
|
7fa004ccd462
(vc-rcs-fetch-master-state): Be more careful to check
Andr? Spiegel <spiegel@gnu.org>
parents:
44004
diff
changeset
|
570 (error "File %s is not an RCS master file" (vc-name file))) |
|
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
571 (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
|
572 (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
|
573 (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
|
574 (unless workfile-version |
|
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
575 ;; 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
|
576 ;; 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
|
577 ;; 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
|
578 ;; revision number. |
|
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
579 (cond |
|
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
580 ;; no default branch |
|
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
581 ((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
|
582 (setq workfile-version |
|
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
583 (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
|
584 (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
|
585 ;; 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
|
586 ((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
|
587 default-branch) |
|
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
588 (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
|
589 ;; 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
|
590 (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
|
591 (setq workfile-version |
|
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
592 (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
|
593 (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
|
594 (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
|
595 ;; Check strict locking |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
596 (goto-char (point-min)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
597 (vc-file-setprop file 'vc-checkout-model |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
598 (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
|
599 'locking 'implicit)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
600 ;; Compute state of workfile version |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
601 (goto-char (point-min)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
602 (let ((locking-user |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
603 (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
|
604 (regexp-quote workfile-version) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
605 "[^0-9.]") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
606 1))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
607 (cond |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
608 ;; not locked |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
609 ((not locking-user) |
| 31476 | 610 (if (or workfile-is-latest |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
611 (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
|
612 ;; 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
|
613 'up-to-date |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
614 ;; workfile version is not latest on branch |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
615 'needs-patch)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
616 ;; locked by the calling user |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
617 ((and (stringp locking-user) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
618 (string= locking-user (vc-user-login-name))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
619 (if (or (eq (vc-checkout-model file) 'locking) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
620 workfile-is-latest |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
621 (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
|
622 'edited |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
623 ;; 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
|
624 ;; 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
|
625 ;; 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
|
626 ;; to use `needs-merge' in this case. |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
627 'needs-merge)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
628 ;; locked by somebody else |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
629 ((stringp locking-user) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
630 locking-user) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
631 (t |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
632 (error "Error getting state of RCS file"))))))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
633 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
634 (defun vc-rcs-consult-headers (file) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
635 "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
|
636 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
637 Returns: nil if no headers were found |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
638 'rev if a workfile revision was found |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
639 '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
|
640 (cond |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
641 ((not (get-file-buffer file)) nil) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
642 ((let (status version locking-user) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
643 (save-excursion |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
644 (set-buffer (get-file-buffer file)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
645 (goto-char (point-min)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
646 (cond |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
647 ;; search for $Id or $Header |
|
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 ;; 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
|
650 ((or (and (search-forward "$Id\ : " nil t) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
651 (looking-at "[^ ]+ \\([0-9.]+\\) ")) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
652 (and (progn (goto-char (point-min)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
653 (search-forward "$Header\ : " nil t)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
654 (looking-at "[^ ]+ \\([0-9.]+\\) "))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
655 (goto-char (match-end 0)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
656 ;; if found, store the revision number ... |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
657 (setq version (match-string-no-properties 1)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
658 ;; ... and check for the locking state |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
659 (cond |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
660 ((looking-at |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
661 (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
|
662 "[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
|
663 "[^ ]+ [^ ]+ ")) ; author & state |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
664 (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
|
665 (cond |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
666 ;; unlocked revision |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
667 ((looking-at "\\$") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
668 (setq locking-user 'none) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
669 (setq status 'rev-and-lock)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
670 ;; revision is locked by some user |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
671 ((looking-at "\\([^ ]+\\) \\$") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
672 (setq locking-user (match-string-no-properties 1)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
673 (setq status 'rev-and-lock)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
674 ;; everything else: false |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
675 (nil))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
676 ;; unexpected information in |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
677 ;; keyword string --> quit |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
678 (nil))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
679 ;; search for $Revision |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
680 ;; -------------------- |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
681 ((re-search-forward (concat "\\$" |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
682 "Revision: \\([0-9.]+\\) \\$") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
683 nil t) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
684 ;; if found, store the revision number ... |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
685 (setq version (match-string-no-properties 1)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
686 ;; and see if there's any lock information |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
687 (goto-char (point-min)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
688 (if (re-search-forward (concat "\\$" "Locker:") nil t) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
689 (cond ((looking-at " \\([^ ]+\\) \\$") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
690 (setq locking-user (match-string-no-properties 1)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
691 (setq status 'rev-and-lock)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
692 ((looking-at " *\\$") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
693 (setq locking-user 'none) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
694 (setq status 'rev-and-lock)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
695 (t |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
696 (setq locking-user 'none) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
697 (setq status 'rev-and-lock))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
698 (setq status 'rev))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
699 ;; else: nothing found |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
700 ;; ------------------- |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
701 (t nil))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
702 (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
|
703 (and (eq status 'rev-and-lock) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
704 (vc-file-setprop file 'vc-state |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
705 (cond |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
706 ((eq locking-user 'none) 'up-to-date) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
707 ((string= locking-user (vc-user-login-name)) 'edited) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
708 (t locking-user))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
709 ;; 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
|
710 ;; master file, because that would eliminate all the |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
711 ;; performance gain the headers brought us. We therefore |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
712 ;; 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
|
713 ;; 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
|
714 ;; 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
|
715 ;; 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
|
716 ;; locking is not used. |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
717 (not (vc-mistrust-permissions file)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
718 (vc-up-to-date-p file) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
719 (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
|
720 (vc-file-setprop file 'vc-checkout-model 'locking) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
721 (vc-file-setprop file 'vc-checkout-model 'implicit))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
722 status)))) |
|
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-release-greater-or-equal (r1 r2) |
| 31476 | 725 "Compare release numbers, represented as strings. |
| 726 Release components are assumed cardinal numbers, not decimal fractions | |
| 727 \(5.10 is a higher release than 5.9\). Omitted fields are considered | |
| 728 lower \(5.6.7 is earlier than 5.6.7.1\). Comparison runs till the end | |
| 729 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
|
730 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
|
731 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
|
732 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
|
733 (let (v1 v2 i1 i2) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
734 (catch 'done |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
735 (or (and (string-match "^\\.?\\([0-9]+\\)" r1) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
736 (setq i1 (match-end 0)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
737 (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
|
738 (or (and (string-match "^\\.?\\([0-9]+\\)" r2) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
739 (setq i2 (match-end 0)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
740 (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
|
741 (if (> v1 v2) (throw 'done t) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
742 (if (< v1 v2) (throw 'done nil) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
743 (throw 'done |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
744 (vc-release-greater-or-equal |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
745 (substring r1 i1) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
746 (substring r2 i2))))))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
747 (throw 'done t))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
748 (or (and (string-match "^\\.?\\([0-9]+\\)" r2) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
749 (throw 'done nil)) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
750 (throw 'done t))))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
751 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
752 (defun vc-rcs-release-p (release) |
| 31476 | 753 "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
|
754 (let ((installation (vc-rcs-system-release))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
755 (if (and installation |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
756 (not (eq installation 'unknown))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
757 (vc-release-greater-or-equal installation release)))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
758 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
759 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
760 (defun vc-rcs-system-release () |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
761 "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
|
762 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
|
763 override this using variable `vc-rcs-release'. |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
764 |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
765 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
|
766 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
|
767 (or vc-rcs-release |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
768 (setq vc-rcs-release |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
769 (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
|
770 (with-current-buffer (get-buffer "*vc*") |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
771 (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
772 'unknown)))) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
773 |
|
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
Andr? Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
774 (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
|
775 (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
|
776 (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
|
777 (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
|
778 |
|
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
Andr? Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
779 (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
|
780 (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
|
781 (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
|
782 |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
783 (provide 'vc-rcs) |
|
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
784 |
| 52401 | 785 ;;; arch-tag: 759b4916-5b0d-431d-b647-b185b8c652cf |
|
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
786 ;;; vc-rcs.el ends here |
