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