Mercurial > emacs
annotate lisp/vc-rcs.el @ 80604:234fcb1810c9
(keycode_to_xkeysym_table): Add entries for f17, f18, and f19.
[MAC_OSX] (fn_keycode_to_keycode_table): Likewise.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Fri, 11 Jul 2008 08:53:12 +0000 |
parents | 73661ddc7ac7 |
children | 107ccd98fa12 |
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 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
79721 | 4 ;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76694
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
31383
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 |
64091 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
31383
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)) |
68332
a6ef676caa6d
(vc-rcs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
64762
diff
changeset
|
155 (let* ((attributes (file-attributes file 'string)) |
a6ef676caa6d
(vc-rcs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
64762
diff
changeset
|
156 (owner-name (nth 2 attributes)) |
31383
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 |
68332
a6ef676caa6d
(vc-rcs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
64762
diff
changeset
|
165 owner-name) |
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 | |
78519
b2a41f8ce78a
(vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
228 (defun vc-rcs-find-file-not-found-hook () |
b2a41f8ce78a
(vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
229 (if (yes-or-no-p |
b2a41f8ce78a
(vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
230 (format "File %s was lost; check out from version control? " |
b2a41f8ce78a
(vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
231 (file-name-nondirectory buffer-file-name))) |
b2a41f8ce78a
(vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
232 (save-excursion |
b2a41f8ce78a
(vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
233 (require 'vc) |
b2a41f8ce78a
(vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
234 (let ((default-directory (file-name-directory buffer-file-name))) |
b2a41f8ce78a
(vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
235 (not (vc-error-occurred (vc-checkout buffer-file-name))))))) |
33560 | 236 |
237 ;;; | |
238 ;;; State-changing functions | |
239 ;;; | |
240 | |
241 (defun vc-rcs-register (file &optional rev comment) | |
242 "Register FILE into the RCS version-control system. | |
243 REV is the optional revision number for the file. COMMENT can be used | |
244 to provide an initial description of FILE. | |
245 | |
246 `vc-register-switches' and `vc-rcs-register-switches' are passed to | |
247 the RCS command (in that order). | |
248 | |
249 Automatically retrieve a read-only version of the file with keywords | |
250 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
|
251 (let ((subdir (expand-file-name "RCS" (file-name-directory file)))) |
33560 | 252 (and (not (file-exists-p subdir)) |
253 (not (directory-files (file-name-directory file) | |
254 nil ".*,v$" t)) | |
255 (yes-or-no-p "Create RCS subdirectory? ") | |
256 (make-directory subdir)) | |
257 (apply 'vc-do-command nil 0 "ci" file | |
258 ;; if available, use the secure registering option | |
259 (and (vc-rcs-release-p "5.6.4") "-i") | |
260 (concat (if vc-keep-workfiles "-u" "-r") rev) | |
261 (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
|
262 (vc-switches 'RCS 'register)) |
33560 | 263 ;; parse output to find master file name and workfile version |
264 (with-current-buffer "*vc*" | |
265 (goto-char (point-min)) | |
266 (let ((name (if (looking-at (concat "^\\(.*\\) <-- " | |
267 (file-name-nondirectory file))) | |
268 (match-string 1)))) | |
269 (if (not name) | |
270 ;; if we couldn't find the master name, | |
271 ;; run vc-rcs-registered to get it | |
272 ;; (will be stored into the vc-name property) | |
273 (vc-rcs-registered file) | |
274 (vc-file-setprop file 'vc-name | |
275 (if (file-name-absolute-p name) | |
276 name | |
277 (expand-file-name | |
278 name | |
279 (file-name-directory file)))))) | |
280 (vc-file-setprop file 'vc-workfile-version | |
281 (if (re-search-forward | |
282 "^initial revision: \\([0-9.]+\\).*\n" | |
283 nil t) | |
284 (match-string 1)))))) | |
285 | |
286 (defun vc-rcs-responsible-p (file) | |
287 "Return non-nil if RCS thinks it would be responsible for registering FILE." | |
288 ;; TODO: check for all the patterns in vc-rcs-master-templates | |
289 (file-directory-p (expand-file-name "RCS" (file-name-directory file)))) | |
290 | |
291 (defun vc-rcs-receive-file (file rev) | |
292 "Implementation of receive-file for RCS." | |
293 (let ((checkout-model (vc-checkout-model file))) | |
294 (vc-rcs-register file rev "") | |
295 (when (eq checkout-model 'implicit) | |
296 (vc-rcs-set-non-strict-locking file)) | |
297 (vc-rcs-set-default-branch file (concat rev ".1")))) | |
298 | |
299 (defun vc-rcs-unregister (file) | |
300 "Unregister FILE from RCS. | |
301 If this leaves the RCS subdirectory empty, ask the user | |
302 whether to remove it." | |
303 (let* ((master (vc-name file)) | |
304 (dir (file-name-directory master)) | |
305 (backup-info (find-backup-file-name master))) | |
306 (if (not backup-info) | |
307 (delete-file master) | |
308 (rename-file master (car backup-info) 'ok-if-already-exists) | |
309 (dolist (f (cdr backup-info)) (ignore-errors (delete-file f)))) | |
310 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS") | |
311 ;; check whether RCS dir is empty, i.e. it does not | |
312 ;; contain any files except "." and ".." | |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
313 (not (directory-files dir nil |
33560 | 314 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*")) |
315 (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) | |
316 (delete-directory dir)))) | |
317 | |
318 (defun vc-rcs-checkin (file rev comment) | |
319 "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
|
320 (let ((switches (vc-switches 'RCS 'checkin))) |
33560 | 321 (let ((old-version (vc-workfile-version file)) new-version |
322 (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) | |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
323 ;; Force branch creation if an appropriate |
33560 | 324 ;; default branch has been set. |
325 (and (not rev) | |
326 default-branch | |
327 (string-match (concat "^" (regexp-quote old-version) "\\.") | |
328 default-branch) | |
329 (setq rev default-branch) | |
330 (setq switches (cons "-f" switches))) | |
48969
8a48bb5e7e5b
(vc-rcs-checkin): By default, always specify the
André Spiegel <spiegel@gnu.org>
parents:
48966
diff
changeset
|
331 (if (and (not rev) old-version) |
8a48bb5e7e5b
(vc-rcs-checkin): By default, always specify the
André Spiegel <spiegel@gnu.org>
parents:
48966
diff
changeset
|
332 (setq rev (vc-branch-part old-version))) |
33560 | 333 (apply 'vc-do-command nil 0 "ci" (vc-name file) |
334 ;; if available, use the secure check-in option | |
335 (and (vc-rcs-release-p "5.6.4") "-j") | |
336 (concat (if vc-keep-workfiles "-u" "-r") rev) | |
337 (concat "-m" comment) | |
338 switches) | |
339 (vc-file-setprop file 'vc-workfile-version nil) | |
340 | |
341 ;; determine the new workfile version | |
342 (set-buffer "*vc*") | |
343 (goto-char (point-min)) | |
344 (when (or (re-search-forward | |
345 "new revision: \\([0-9.]+\\);" nil t) | |
346 (re-search-forward | |
347 "reverting to previous revision \\([0-9.]+\\)" nil t)) | |
348 (setq new-version (match-string 1)) | |
349 (vc-file-setprop file 'vc-workfile-version new-version)) | |
350 | |
351 ;; if we got to a different branch, adjust the default | |
352 ;; branch accordingly | |
353 (cond | |
354 ((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
|
355 (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
|
356 (vc-branch-part new-version)))) |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
357 (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
|
358 (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
|
359 (vc-branch-part new-version))) |
33560 | 360 ;; If this is an old RCS release, we might have |
361 ;; to remove a remaining lock. | |
362 (if (not (vc-rcs-release-p "5.6.2")) | |
363 ;; exit status of 1 is also accepted. | |
364 ;; It means that the lock was removed before. | |
365 (vc-do-command nil 1 "rcs" (vc-name file) | |
366 (concat "-u" old-version)))))))) | |
367 | |
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
368 (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
|
369 (apply 'vc-do-command |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
370 buffer 0 "co" (vc-name file) |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
371 "-q" ;; suppress diagnostic output |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
372 (concat "-p" rev) |
50903
c03b80e1bacd
(vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
373 (vc-switches 'RCS 'checkout))) |
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
374 |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
375 (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
|
376 "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
|
377 (let ((file-buffer (get-file-buffer file)) |
33560 | 378 switches) |
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
379 (message "Checking out %s..." file) |
33560 | 380 (save-excursion |
381 ;; Change buffers to get local value of vc-checkout-switches. | |
382 (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
|
383 (setq switches (vc-switches 'RCS 'checkout)) |
33560 | 384 ;; Save this buffer's default-directory |
385 ;; and use save-excursion to make sure it is restored | |
386 ;; in the same buffer it was saved in. | |
387 (let ((default-directory default-directory)) | |
388 (save-excursion | |
389 ;; Adjust the default-directory so that the check-out creates | |
390 ;; the file in the right place. | |
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
391 (setq default-directory (file-name-directory file)) |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
392 (let (new-version) |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
393 ;; 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
|
394 ;; clear the default branch first |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
395 (and rev (string= rev "") |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
396 (vc-rcs-set-default-branch file nil)) |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
397 ;; now do the checkout |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
398 (apply 'vc-do-command |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
399 nil 0 "co" (vc-name file) |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
400 ;; 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
|
401 ;; the writable workfile. |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
402 (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
|
403 (if editable "-l") |
48966
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
404 (if (stringp rev) |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
405 ;; a literal revision was specified |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
406 (concat "-r" rev) |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
407 (let ((workrev (vc-workfile-version file))) |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
408 (if workrev |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
409 (concat "-r" |
48966
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
410 (if (not rev) |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
411 ;; no revision specified: |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
412 ;; use current workfile version |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
413 workrev |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
414 ;; 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
|
415 (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
|
416 ;; ... go to head of current branch |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
417 (vc-branch-part workrev) |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
418 ;; ... go to head of trunk |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
419 (vc-rcs-set-default-branch file |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
420 nil) |
a327c58de610
(vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
48282
diff
changeset
|
421 "")))))) |
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
422 switches) |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
423 ;; determine the new workfile version |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
424 (with-current-buffer "*vc*" |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
425 (setq new-version |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
426 (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
|
427 (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
|
428 ;; if necessary, adjust the default branch |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
429 (and rev (not (string= rev "")) |
58320
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
430 (vc-rcs-set-default-branch |
47797
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
431 file |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
432 (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
|
433 (if (vc-trunk-p new-version) nil |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
434 (vc-branch-part new-version)) |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
435 new-version))))) |
d0555af982c8
(vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47757
diff
changeset
|
436 (message "Checking out %s...done" file))))) |
33560 | 437 |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38436
diff
changeset
|
438 (defun vc-rcs-revert (file &optional contents-done) |
33560 | 439 "Revert FILE to the version it was based on." |
440 (vc-do-command nil 0 "co" (vc-name file) "-f" | |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49092
diff
changeset
|
441 (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
|
442 (vc-workfile-version file)))) |
33560 | 443 |
35133
1b45907ef7a8
(vc-rcs-checkout, vc-rcs-cancel-version): Renamed arg WRITABLE to EDITABLE.
André Spiegel <spiegel@gnu.org>
parents:
33636
diff
changeset
|
444 (defun vc-rcs-cancel-version (file editable) |
33560 | 445 "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
|
446 EDITABLE non-nil means previous version should be locked." |
33560 | 447 (let* ((target (vc-workfile-version file)) |
448 (previous (if (vc-trunk-p target) "" (vc-branch-part target))) | |
449 (config (current-window-configuration)) | |
450 (done nil)) | |
451 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target)) | |
452 ;; Check out the most recent remaining version. If it fails, because | |
453 ;; the whole branch got deleted, do a double-take and check out the | |
454 ;; version where the branch started. | |
455 (while (not done) | |
456 (condition-case err | |
457 (progn | |
458 (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
|
459 (concat (if editable "-l" "-u") previous)) |
33560 | 460 (setq done t)) |
461 (error (set-buffer "*vc*") | |
462 (goto-char (point-min)) | |
463 (if (search-forward "no side branches present for" nil t) | |
464 (progn (setq previous (vc-branch-part previous)) | |
465 (vc-rcs-set-default-branch file previous) | |
466 ;; vc-do-command popped up a window with | |
467 ;; the error message. Get rid of it, by | |
468 ;; restoring the old window configuration. | |
469 (set-window-configuration config)) | |
470 ;; No, it was some other error: re-signal it. | |
471 (signal (car err) (cdr err)))))))) | |
472 | |
473 (defun vc-rcs-merge (file first-version &optional second-version) | |
474 "Merge changes into current working copy of FILE. | |
475 The changes are between FIRST-VERSION and SECOND-VERSION." | |
476 (vc-do-command nil 1 "rcsmerge" (vc-name file) | |
477 "-kk" ; ignore keyword conflicts | |
478 (concat "-r" first-version) | |
479 (if second-version (concat "-r" second-version)))) | |
480 | |
481 (defun vc-rcs-steal-lock (file &optional rev) | |
482 "Steal the lock on the current workfile for FILE and revision REV. | |
483 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
|
484 (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
|
485 ;; 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
|
486 ;; 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
|
487 (vc-do-command nil 0 "co" (vc-name file) "-f" (concat "-l" rev))) |
33560 | 488 |
489 | |
490 | |
491 ;;; | |
492 ;;; History functions | |
493 ;;; | |
494 | |
54466
37e95eddf2e8
(vc-rcs-print-log, vc-rcs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
495 (defun vc-rcs-print-log (file &optional buffer) |
33560 | 496 "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
|
497 (vc-do-command buffer 0 "rlog" (vc-name file))) |
33560 | 498 |
54466
37e95eddf2e8
(vc-rcs-print-log, vc-rcs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
499 (defun vc-rcs-diff (file &optional oldvers newvers buffer) |
33560 | 500 "Get a difference report using RCS between two versions of FILE." |
501 (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
|
502 (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
|
503 (append (list "-q" |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
504 (concat "-r" oldvers) |
cd59c63d4aac
(vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35178
diff
changeset
|
505 (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
|
506 (vc-switches 'RCS 'diff)))) |
33560 | 507 |
58320
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
508 (defun vc-rcs-annotate-command (file buffer &optional revision) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
509 "Annotate FILE, inserting the results in BUFFER. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
510 Optional arg REVISION is a revision to annotate from." |
59181
a22da8bff83f
(vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
58320
diff
changeset
|
511 (vc-setup-buffer buffer) |
58320
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
512 ;; Aside from the "head revision on the trunk", the instructions for |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
513 ;; each revision on the trunk are an ordered list of kill and insert |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
514 ;; commands necessary to go from the chronologically-following |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
515 ;; revision to this one. That is, associated with revision N are |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
516 ;; edits that applied to revision N+1 would result in revision N. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
517 ;; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
518 ;; On a branch, however, (some) things are inverted: the commands |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
519 ;; listed are those necessary to go from the chronologically-preceding |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
520 ;; revision to this one. That is, associated with revision N are |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
521 ;; edits that applied to revision N-1 would result in revision N. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
522 ;; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
523 ;; So, to get per-line history info, we apply reverse-chronological |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
524 ;; edits, starting with the head revision on the trunk, all the way |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
525 ;; back through the initial revision (typically "1.1" or similar), |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
526 ;; then apply forward-chronological edits -- keeping track of which |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
527 ;; revision is associated with each inserted line -- until we reach |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
528 ;; the desired revision for display (which may be either on the trunk |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
529 ;; or on a branch). |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
530 (let* ((tree (with-temp-buffer |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
531 (insert-file-contents (vc-rcs-registered file)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
532 (vc-rcs-parse))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
533 (revisions (cdr (assq 'revisions tree))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
534 ;; The revision N whose instructions we currently are processing. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
535 (cur (cdr (assq 'head (cdr (assq 'headers tree))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
536 ;; Alist from the parse tree for N. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
537 (meta (cdr (assoc cur revisions))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
538 ;; Point and temporary string, respectively. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
539 p s |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
540 ;; "Next-branch list". Nil means the desired revision to |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
541 ;; display lives on the trunk. Non-nil means it lives on a |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
542 ;; branch, in which case the value is a list of revision pairs |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
543 ;; (PARENT . CHILD), the first PARENT being on the trunk, that |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
544 ;; links each series of revisions in the path from the initial |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
545 ;; revision to the desired revision to display. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
546 nbls |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
547 ;; "Path-accumulate-predicate plus revision/date/author". |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
548 ;; Until set, forward-chronological edits are not accumulated. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
549 ;; Once set, its value (updated every revision) is used for |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
550 ;; the text property `:vc-rcs-r/d/a' for inserts during |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
551 ;; processing of forward-chronological instructions for N. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
552 ;; See internal func `r/d/a'. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
553 prda |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
554 ;; List of forward-chronological instructions, each of the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
555 ;; form: (POS . ACTION), where POS is a buffer position. If |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
556 ;; ACTION is a string, it is inserted, otherwise it is taken as |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
557 ;; the number of characters to be deleted. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
558 path |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
559 ;; N+1. When `cur' is "", this is the initial revision. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
560 pre) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
561 (unless revision |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
562 (setq revision cur)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
563 (unless (assoc revision revisions) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
564 (error "No such revision: %s" revision)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
565 ;; Find which branches (if any) must be included in the edits. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
566 (let ((par revision) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
567 bpt kids) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
568 (while (setq bpt (vc-branch-part par) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
569 par (vc-branch-part bpt)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
570 (setq kids (cdr (assq 'branches (cdr (assoc par revisions))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
571 ;; A branchpoint may have multiple children. Find the right one. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
572 (while (not (string= bpt (vc-branch-part (car kids)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
573 (setq kids (cdr kids))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
574 (push (cons par (car kids)) nbls))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
575 ;; Start with the full text. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
576 (set-buffer buffer) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
577 (insert (cdr (assq 'text meta))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
578 ;; Apply reverse-chronological edits on the trunk, computing and |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
579 ;; accumulating forward-chronological edits after some point, for |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
580 ;; later. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
581 (flet ((r/d/a () (vector pre |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
582 (cdr (assq 'date meta)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
583 (cdr (assq 'author meta))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
584 (while (when (setq pre cur cur (cdr (assq 'next meta))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
585 (not (string= "" cur))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
586 (setq |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
587 ;; Start accumulating the forward-chronological edits when N+1 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
588 ;; on the trunk is either the desired revision to display, or |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
589 ;; the appropriate branchpoint for it. Do this before |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
590 ;; updating `meta' since `r/d/a' uses N+1's `meta' value. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
591 prda (when (or prda (string= (if nbls (caar nbls) revision) pre)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
592 (r/d/a)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
593 meta (cdr (assoc cur revisions))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
594 ;; Edits in the parse tree specify a line number (in the buffer |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
595 ;; *BEFORE* editing occurs) to start from, but line numbers |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
596 ;; change as a result of edits. To DTRT, we apply edits in |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
597 ;; order of descending buffer position so that edits further |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
598 ;; down in the buffer occur first w/o corrupting specified |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
599 ;; buffer positions of edits occurring towards the beginning of |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
600 ;; the buffer. In this way we avoid using markers. A pleasant |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
601 ;; property of this approach is ability to push instructions |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
602 ;; onto `path' directly, w/o need to maintain rev boundaries. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
603 (dolist (insn (cdr (assq :insn meta))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
604 (goto-line (pop insn)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
605 (setq p (point)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
606 (case (pop insn) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
607 (k (setq s (buffer-substring-no-properties |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
608 p (progn (forward-line (car insn)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
609 (point)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
610 (when prda |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
611 (push `(,p . ,(propertize s :vc-rcs-r/d/a prda)) path)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
612 (delete-region p (point))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
613 (i (setq s (car insn)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
614 (when prda |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
615 (push `(,p . ,(length s)) path)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
616 (insert s))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
617 ;; For the initial revision, setting `:vc-rcs-r/d/a' directly is |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
618 ;; equivalent to pushing an insert instruction (of the entire buffer |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
619 ;; contents) onto `path' then erasing the buffer, but less wasteful. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
620 (put-text-property (point-min) (point-max) :vc-rcs-r/d/a (r/d/a)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
621 ;; Now apply the forward-chronological edits for the trunk. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
622 (dolist (insn path) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
623 (goto-char (pop insn)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
624 (if (stringp insn) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
625 (insert insn) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
626 (delete-char insn))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
627 ;; Now apply the forward-chronological edits (directly from the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
628 ;; parse-tree) for the branch(es), if necessary. We re-use vars |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
629 ;; `pre' and `meta' for the sake of internal func `r/d/a'. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
630 (while nbls |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
631 (setq pre (cdr (pop nbls))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
632 (while (progn |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
633 (setq meta (cdr (assoc pre revisions)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
634 prda nil) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
635 (dolist (insn (cdr (assq :insn meta))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
636 (goto-line (pop insn)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
637 (case (pop insn) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
638 (k (delete-region |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
639 (point) (progn (forward-line (car insn)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
640 (point)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
641 (i (insert (propertize |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
642 (car insn) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
643 :vc-rcs-r/d/a |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
644 (or prda (setq prda (r/d/a)))))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
645 (prog1 (not (string= (if nbls (caar nbls) revision) pre)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
646 (setq pre (cdr (assq 'next meta))))))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
647 ;; Lastly, for each line, insert at bol nicely-formatted history info. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
648 ;; We do two passes to collect summary information used to minimize |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
649 ;; the annotation's usage of screen real-estate: (1) Consider rendered |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
650 ;; width of revision plus author together as a unit; and (2) Omit |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
651 ;; author entirely if all authors are the same as the user. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
652 (let ((ht (make-hash-table :test 'eq)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
653 (me (user-login-name)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
654 (maxw 0) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
655 (all-me t) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
656 rda w a) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
657 (goto-char (point-max)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
658 (while (not (bobp)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
659 (forward-line -1) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
660 (setq rda (get-text-property (point) :vc-rcs-r/d/a)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
661 (unless (gethash rda ht) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
662 (setq a (aref rda 2) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
663 all-me (and all-me (string= a me))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
664 (puthash rda (setq w (+ (length (aref rda 0)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
665 (length a))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
666 ht) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
667 (setq maxw (max w maxw)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
668 (let ((padding (make-string maxw 32))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
669 (flet ((pad (w) (substring-no-properties padding w)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
670 (render (rda &rest ls) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
671 (propertize |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
672 (apply 'concat |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
673 (format-time-string "%Y-%m-%d" (aref rda 1)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
674 " " |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
675 (aref rda 0) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
676 ls) |
76694
f35ed3fecce9
(vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
75347
diff
changeset
|
677 :vc-annotate-prefix t |
58320
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
678 :vc-rcs-r/d/a rda))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
679 (maphash |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
680 (if all-me |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
681 (lambda (rda w) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
682 (puthash rda (render rda (pad w) ": ") ht)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
683 (lambda (rda w) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
684 (puthash rda (render rda " " (pad w) " " (aref rda 2) ": ") ht))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
685 ht))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
686 (while (not (eobp)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
687 (insert (gethash (get-text-property (point) :vc-rcs-r/d/a) ht)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
688 (forward-line 1)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
689 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
690 (defun vc-rcs-annotate-current-time () |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
691 "Return the current time, based at midnight of the current day, and |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
692 encoded as fractional days." |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
693 (vc-annotate-convert-time |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
694 (apply 'encode-time 0 0 0 (nthcdr 3 (decode-time (current-time)))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
695 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
696 (defun vc-rcs-annotate-time () |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
697 "Return the time of the next annotation (as fraction of days) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
698 systime, or nil if there is none. Also, reposition point." |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
699 (unless (eobp) |
76694
f35ed3fecce9
(vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
75347
diff
changeset
|
700 (prog1 (vc-annotate-convert-time |
f35ed3fecce9
(vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
75347
diff
changeset
|
701 (aref (get-text-property (point) :vc-rcs-r/d/a) 1)) |
f35ed3fecce9
(vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
75347
diff
changeset
|
702 (goto-char (next-single-property-change (point) :vc-annotate-prefix))))) |
58320
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
703 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
704 (defun vc-rcs-annotate-extract-revision-at-line () |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
705 (aref (get-text-property (point) :vc-rcs-r/d/a) 0)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
706 |
33560 | 707 |
708 ;;; | |
709 ;;; Snapshot system | |
710 ;;; | |
711 | |
712 (defun vc-rcs-assign-name (file name) | |
713 "Assign to FILE's latest version a given NAME." | |
714 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-n" name ":"))) | |
715 | |
716 | |
717 ;;; | |
718 ;;; Miscellaneous | |
719 ;;; | |
720 | |
721 (defun vc-rcs-check-headers () | |
722 "Check if the current file has any headers in it." | |
723 (save-excursion | |
724 (goto-char (point-min)) | |
725 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\ | |
726 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t))) | |
727 | |
728 (defun vc-rcs-clear-headers () | |
729 "Implementation of vc-clear-headers for RCS." | |
730 (let ((case-fold-search nil)) | |
731 (goto-char (point-min)) | |
732 (while (re-search-forward | |
733 (concat "\\$\\(Author\\|Date\\|Header\\|Id\\|Locker\\|Name\\|" | |
734 "RCSfile\\|Revision\\|Source\\|State\\): [^$\n]+\\$") | |
735 nil t) | |
736 (replace-match "$\\1$")))) | |
737 | |
738 (defun vc-rcs-rename-file (old new) | |
739 ;; Just move the master file (using vc-rcs-master-templates). | |
740 (vc-rename-master (vc-name old) new vc-rcs-master-templates)) | |
741 | |
742 | |
743 ;;; | |
744 ;;; Internal functions | |
745 ;;; | |
746 | |
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
747 (defun vc-rcs-workfile-is-newer (file) |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
748 "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
|
749 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
|
750 to its master version." |
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
751 (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
|
752 (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
|
753 (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
|
754 (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
|
755 (> (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
|
756 |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
757 (defun vc-rcs-find-most-recent-rev (branch) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
758 "Find most recent revision on BRANCH." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
759 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
760 (let ((latest-rev -1) value) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
761 (while (re-search-forward (concat "^\\(" (regexp-quote branch) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
762 "\\.\\([0-9]+\\)\\)\ndate[ \t]+[0-9.]+;") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
763 nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
764 (let ((rev (string-to-number (match-string 2)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
765 (when (< latest-rev rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
766 (setq latest-rev rev) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
767 (setq value (match-string 1))))) |
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
768 (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
|
769 (vc-branch-part branch)))) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
770 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
771 (defun vc-rcs-fetch-master-state (file &optional workfile-version) |
31476 | 772 "Compute the master file's idea of the state of FILE. |
773 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
|
774 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
|
775 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
|
776 `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
|
777 file." |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
778 (with-temp-buffer |
46543
7fa004ccd462
(vc-rcs-fetch-master-state): Be more careful to check
André Spiegel <spiegel@gnu.org>
parents:
44004
diff
changeset
|
779 (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
|
780 (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
|
781 (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
|
782 (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
|
783 (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
|
784 (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
|
785 (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
|
786 (unless workfile-version |
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
787 ;; 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
|
788 ;; 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
|
789 ;; 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
|
790 ;; revision number. |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
791 (cond |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
792 ;; no default branch |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
793 ((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
|
794 (setq workfile-version |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
795 (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
|
796 (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
|
797 ;; 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
|
798 ((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
|
799 default-branch) |
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
800 (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
|
801 ;; 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
|
802 (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
|
803 (setq workfile-version |
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
804 (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
|
805 (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
|
806 (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
|
807 ;; Check strict locking |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
808 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
809 (vc-file-setprop file 'vc-checkout-model |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
810 (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
|
811 'locking 'implicit)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
812 ;; Compute state of workfile version |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
813 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
814 (let ((locking-user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
815 (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
|
816 (regexp-quote workfile-version) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
817 "[^0-9.]") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
818 1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
819 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
820 ;; not locked |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
821 ((not locking-user) |
31476 | 822 (if (or workfile-is-latest |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
823 (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
|
824 ;; 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
|
825 'up-to-date |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
826 ;; workfile version is not latest on branch |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
827 'needs-patch)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
828 ;; locked by the calling user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
829 ((and (stringp locking-user) |
68415
469f8d551600
(vc-rcs-fetch-master-state, vc-rcs-consult-headers): Pass FILE to
André Spiegel <spiegel@gnu.org>
parents:
68332
diff
changeset
|
830 (string= locking-user (vc-user-login-name file))) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
831 (if (or (eq (vc-checkout-model file) 'locking) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
832 workfile-is-latest |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
833 (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
|
834 'edited |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
835 ;; 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
|
836 ;; 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
|
837 ;; 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
|
838 ;; to use `needs-merge' in this case. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
839 'needs-merge)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
840 ;; locked by somebody else |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
841 ((stringp locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
842 locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
843 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
844 (error "Error getting state of RCS file"))))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
845 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
846 (defun vc-rcs-consult-headers (file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
847 "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
|
848 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
849 Returns: nil if no headers were found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
850 'rev if a workfile revision was found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
851 '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
|
852 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
853 ((not (get-file-buffer file)) nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
854 ((let (status version locking-user) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
855 (save-excursion |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
856 (set-buffer (get-file-buffer file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
857 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
858 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
859 ;; search for $Id or $Header |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
860 ;; ------------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
861 ;; 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
|
862 ((or (and (search-forward "$Id\ : " nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
863 (looking-at "[^ ]+ \\([0-9.]+\\) ")) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
864 (and (progn (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
865 (search-forward "$Header\ : " nil t)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
866 (looking-at "[^ ]+ \\([0-9.]+\\) "))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
867 (goto-char (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
868 ;; if found, store the revision number ... |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
869 (setq version (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
870 ;; ... and check for the locking state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
871 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
872 ((looking-at |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
873 (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
|
874 "[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
|
875 "[^ ]+ [^ ]+ ")) ; author & state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
876 (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
|
877 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
878 ;; unlocked revision |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
879 ((looking-at "\\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
880 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
881 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
882 ;; revision is locked by some user |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
883 ((looking-at "\\([^ ]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
884 (setq locking-user (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
885 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
886 ;; everything else: false |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
887 (nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
888 ;; unexpected information in |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
889 ;; keyword string --> quit |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
890 (nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
891 ;; search for $Revision |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
892 ;; -------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
893 ((re-search-forward (concat "\\$" |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
894 "Revision: \\([0-9.]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
895 nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
896 ;; if found, store the revision number ... |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
897 (setq version (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
898 ;; and see if there's any lock information |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
899 (goto-char (point-min)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
900 (if (re-search-forward (concat "\\$" "Locker:") nil t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
901 (cond ((looking-at " \\([^ ]+\\) \\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
902 (setq locking-user (match-string-no-properties 1)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
903 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
904 ((looking-at " *\\$") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
905 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
906 (setq status 'rev-and-lock)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
907 (t |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
908 (setq locking-user 'none) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
909 (setq status 'rev-and-lock))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
910 (setq status 'rev))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
911 ;; else: nothing found |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
912 ;; ------------------- |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
913 (t nil))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
914 (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
|
915 (and (eq status 'rev-and-lock) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
916 (vc-file-setprop file 'vc-state |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
917 (cond |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
918 ((eq locking-user 'none) 'up-to-date) |
76694
f35ed3fecce9
(vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
75347
diff
changeset
|
919 ((string= locking-user (vc-user-login-name file)) |
68415
469f8d551600
(vc-rcs-fetch-master-state, vc-rcs-consult-headers): Pass FILE to
André Spiegel <spiegel@gnu.org>
parents:
68332
diff
changeset
|
920 'edited) |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
921 (t locking-user))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
922 ;; 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
|
923 ;; master file, because that would eliminate all the |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
924 ;; performance gain the headers brought us. We therefore |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
925 ;; 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
|
926 ;; 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
|
927 ;; 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
|
928 ;; 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
|
929 ;; locking is not used. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
930 (not (vc-mistrust-permissions file)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
931 (vc-up-to-date-p file) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
932 (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
|
933 (vc-file-setprop file 'vc-checkout-model 'locking) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
934 (vc-file-setprop file 'vc-checkout-model 'implicit))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
935 status)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
936 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
937 (defun vc-release-greater-or-equal (r1 r2) |
31476 | 938 "Compare release numbers, represented as strings. |
939 Release components are assumed cardinal numbers, not decimal fractions | |
940 \(5.10 is a higher release than 5.9\). Omitted fields are considered | |
941 lower \(5.6.7 is earlier than 5.6.7.1\). Comparison runs till the end | |
942 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
|
943 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
|
944 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
|
945 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
|
946 (let (v1 v2 i1 i2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
947 (catch 'done |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
948 (or (and (string-match "^\\.?\\([0-9]+\\)" r1) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
949 (setq i1 (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
950 (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
|
951 (or (and (string-match "^\\.?\\([0-9]+\\)" r2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
952 (setq i2 (match-end 0)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
953 (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
|
954 (if (> v1 v2) (throw 'done t) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
955 (if (< v1 v2) (throw 'done nil) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
956 (throw 'done |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
957 (vc-release-greater-or-equal |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
958 (substring r1 i1) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
959 (substring r2 i2))))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
960 (throw 'done t))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
961 (or (and (string-match "^\\.?\\([0-9]+\\)" r2) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
962 (throw 'done nil)) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
963 (throw 'done t))))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
964 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
965 (defun vc-rcs-release-p (release) |
31476 | 966 "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
|
967 (let ((installation (vc-rcs-system-release))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
968 (if (and installation |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
969 (not (eq installation 'unknown))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
970 (vc-release-greater-or-equal installation release)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
971 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
972 (defun vc-rcs-system-release () |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
973 "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
|
974 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
|
975 override this using variable `vc-rcs-release'. |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
976 |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
977 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
|
978 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
|
979 (or vc-rcs-release |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
980 (setq vc-rcs-release |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
981 (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
|
982 (with-current-buffer (get-buffer "*vc*") |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
983 (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
984 'unknown)))) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
985 |
31809
a2c432c6b343
(vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents:
31520
diff
changeset
|
986 (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
|
987 (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
|
988 (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
|
989 (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
|
990 |
32094
027fb880735d
(vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents:
32058
diff
changeset
|
991 (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
|
992 (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
|
993 (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
|
994 |
58320
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
995 (defun vc-rcs-parse (&optional buffer) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
996 "Parse current buffer, presumed to be in RCS-style masterfile format. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
997 Optional arg BUFFER specifies another buffer to parse. Return an alist |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
998 of two elements, w/ keys `headers' and `revisions' and values in turn |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
999 sub-alists. For `headers', the values unless otherwise specified are |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1000 strings and the keys are: |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1001 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1002 desc -- description |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1003 head -- latest revision |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1004 branch -- the branch the \"head revision\" lies on; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1005 absent if the head revision lies on the trunk |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1006 access -- ??? |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1007 symbols -- sub-alist of (SYMBOL . REVISION) elements |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1008 locks -- if file is checked out, something like \"ttn:1.7\" |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1009 strict -- t if \"strict locking\" is in effect, otherwise nil |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1010 comment -- may be absent; typically something like \"# \" or \"; \" |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1011 expand -- may be absent; ??? |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1012 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1013 For `revisions', the car is REVISION (string), the cdr a sub-alist, |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1014 with string values (unless otherwise specified) and keys: |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1015 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1016 date -- a time value (like that returned by `encode-time'); as a |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1017 special case, a year value less than 100 is augmented by 1900 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1018 author -- username |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1019 state -- typically \"Exp\" or \"Rel\" |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1020 branches -- list of revisions that begin branches from this revision |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1021 next -- on the trunk: the chronologically-preceding revision, or \"\"; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1022 on a branch: the chronologically-following revision, or \"\" |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1023 log -- change log entry |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1024 text -- for the head revision on the trunk, the body of the file; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1025 other revisions have `:insn' instead |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1026 :insn -- for non-head revisions, a list of parsed instructions |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1027 in one of two forms, in both cases START meaning \"first |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1028 go to line START\": |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1029 - `(START k COUNT)' -- kill COUNT lines |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1030 - `(START i TEXT)' -- insert TEXT (a string) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1031 The list is in descending order by START. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1032 |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1033 The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension." |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1034 (setq buffer (get-buffer (or buffer (current-buffer)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1035 (set-buffer buffer) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1036 ;; An RCS masterfile can be viewed as containing four regular (for the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1037 ;; most part) sections: (a) the "headers", (b) the "rev headers", (c) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1038 ;; the "description" and (d) the "rev bodies", in that order. In the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1039 ;; returned alist (see docstring), elements from (b) and (d) are |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1040 ;; combined pairwise to form the "revisions", while those from (a) and |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1041 ;; (c) are simply combined to form the "headers". |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1042 ;; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1043 ;; Loosely speaking, each section contains a series of alternating |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1044 ;; "tags" and "printed representations". In the (b) and (d), many |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1045 ;; such series can appear, and a revision number on a line by itself |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1046 ;; precedes the series of tags and printed representations associated |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1047 ;; with it. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1048 ;; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1049 ;; In (a) and (b), the printed representations (with the exception of |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1050 ;; the `comment' tag in the headers) terminate with a semicolon, which |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1051 ;; is NOT part of the "value" finally associated with the tag. All |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1052 ;; other printed representations are in "@@-format"; there is an "@", |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1053 ;; the middle part (to be translated into the value), another "@" and |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1054 ;; a newline. Each "@@" in the middle part indicates the position of |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1055 ;; a single "@" (and consequently the requirement of an additional |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1056 ;; initial step when translating to the value). |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1057 ;; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1058 ;; Parser state includes vars that collect parts of the return value... |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1059 (let ((desc nil) (headers nil) (revs nil) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1060 ;; ... as well as vars that support a single-pass, tag-assisted, |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1061 ;; minimal-data-copying scan. Basically -- skirting around the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1062 ;; grouping by revision required in (b) and (d) -- we repeatedly |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1063 ;; and context-sensitively read a tag (that MUST be present), |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1064 ;; determine the bounds of the printed representation, translate |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1065 ;; it into a value, and push the tag plus value onto one of the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1066 ;; collection vars. Finally, we return the parse tree |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1067 ;; incorporating the values of the collection vars (see "rv"). |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1068 ;; |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1069 ;; A symbol or string to keep track of context (for error messages). |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1070 context |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1071 ;; A symbol, the current tag. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1072 tok |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1073 ;; Region (begin and end buffer positions) of the printed |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1074 ;; representation for the current tag. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1075 b e |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1076 ;; A list of buffer positions where "@@" can be found within the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1077 ;; printed representation region. For each location, we push two |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1078 ;; elements onto the list, 1+ and 2+ the location, respectively, |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1079 ;; with the 2+ appearing at the head. In this way, the expression |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1080 ;; `(,e ,@@-holes ,b) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1081 ;; describes regions that can be concatenated (in reverse order) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1082 ;; to "de-@@-format" the printed representation as the first step |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1083 ;; to translating it into some value. See internal func `gather'. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1084 @-holes) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1085 (flet ((sw () (skip-chars-forward " \t\n")) ; i.e., `[:space:]' |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1086 (at (tag) (save-excursion (eq tag (read buffer)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1087 (to-eol () (buffer-substring-no-properties |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1088 (point) (progn (forward-line 1) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1089 (1- (point))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1090 (to-semi () (setq b (point) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1091 e (progn (search-forward ";") |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1092 (1- (point))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1093 (to-one@ () (setq @-holes nil |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1094 b (progn (search-forward "@") (point)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1095 e (progn (while (and (search-forward "@") |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1096 (= ?@ (char-after)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1097 (progn |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1098 (push (point) @-holes) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1099 (forward-char 1) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1100 (push (point) @-holes)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1101 (1- (point))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1102 (tok+val (set-b+e name &optional proc) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1103 (unless (eq name (setq tok (read buffer))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1104 (error "Missing `%s' while parsing %s" name context)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1105 (sw) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1106 (funcall set-b+e) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1107 (cons tok (if proc |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1108 (funcall proc) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1109 (buffer-substring-no-properties b e)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1110 (k-semi (name &optional proc) (tok+val 'to-semi name proc)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1111 (gather () (let ((pairs `(,e ,@@-holes ,b)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1112 acc) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1113 (while pairs |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1114 (push (buffer-substring-no-properties |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1115 (cadr pairs) (car pairs)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1116 acc) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1117 (setq pairs (cddr pairs))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1118 (apply 'concat acc))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1119 (k-one@ (name &optional later) (tok+val 'to-one@ name |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1120 (if later |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1121 (lambda () t) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1122 'gather)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1123 (save-excursion |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1124 (goto-char (point-min)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1125 ;; headers |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1126 (setq context 'headers) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1127 (flet ((hpush (name &optional proc) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1128 (push (k-semi name proc) headers))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1129 (hpush 'head) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1130 (when (at 'branch) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1131 (hpush 'branch)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1132 (hpush 'access) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1133 (hpush 'symbols |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1134 (lambda () |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1135 (mapcar (lambda (together) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1136 (let ((two (split-string together ":"))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1137 (setcar two (intern (car two))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1138 (setcdr two (cadr two)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1139 two)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1140 (split-string |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1141 (buffer-substring-no-properties b e))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1142 (hpush 'locks)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1143 (push `(strict . ,(when (at 'strict) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1144 (search-forward ";") |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1145 t)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1146 headers) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1147 (when (at 'comment) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1148 (push (k-one@ 'comment) headers) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1149 (search-forward ";")) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1150 (when (at 'expand) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1151 (push (k-one@ 'expand) headers) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1152 (search-forward ";")) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1153 (setq headers (nreverse headers)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1154 ;; rev headers |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1155 (sw) (setq context 'rev-headers) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1156 (while (looking-at "[0-9]") |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1157 (push `(,(to-eol) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1158 ,(k-semi 'date |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1159 (lambda () |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1160 (let ((ls (mapcar 'string-to-number |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1161 (split-string |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1162 (buffer-substring-no-properties |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1163 b e) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1164 "\\.")))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1165 ;; Hack the year -- verified to be the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1166 ;; same algorithm used in RCS 5.7. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1167 (when (< (car ls) 100) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1168 (setcar ls (+ 1900 (car ls)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1169 (apply 'encode-time (nreverse ls))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1170 ,@(mapcar 'k-semi '(author state)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1171 ,(k-semi 'branches |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1172 (lambda () |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1173 (split-string |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1174 (buffer-substring-no-properties b e)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1175 ,(k-semi 'next)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1176 revs) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1177 (sw)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1178 (setq revs (nreverse revs)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1179 ;; desc |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1180 (sw) (setq context 'desc |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1181 desc (k-one@ 'desc)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1182 ;; rev bodies |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1183 (let (acc |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1184 ;; Element of `revs' that initially holds only header info. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1185 ;; "Pairwise combination" occurs when we add body info. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1186 rev |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1187 ;; Components of the editing commands (aside from the actual |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1188 ;; text) that comprise the `text' printed representations |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1189 ;; (not including the "head" revision). |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1190 cmd start act |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1191 ;; Ascending (reversed) `@-holes' which the internal func |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1192 ;; `incg' pops to effect incremental gathering. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1193 asc |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1194 ;; Function to extract text (for the `a' command), either |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1195 ;; `incg' or `buffer-substring-no-properties'. (This is |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1196 ;; for speed; strictly speaking, it is sufficient to use |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1197 ;; only the former since it behaves identically to the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1198 ;; latter in the absense of "@@".) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1199 sub) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1200 (flet ((incg (beg end) (let ((b beg) (e end) @-holes) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1201 (while (and asc (< (car asc) e)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1202 (push (pop asc) @-holes)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1203 ;; Self-deprecate when work is done. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1204 ;; Folding many dimensions into one. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1205 ;; Thanks B.Mandelbrot, for complex sum. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1206 ;; O beauteous math! --the Unvexed Bum |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1207 (unless asc |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1208 (setq sub 'buffer-substring-no-properties)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1209 (gather)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1210 (while (and (sw) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1211 (not (eobp)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1212 (setq context (to-eol) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1213 rev (or (assoc context revs) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1214 (error "Rev `%s' has body but no head" |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1215 context)))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1216 (push (k-one@ 'log) (cdr rev)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1217 ;; For rev body `text' tags, delay translation slightly... |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1218 (push (k-one@ 'text t) (cdr rev)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1219 ;; ... until we decide which tag and value is appropriate to |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1220 ;; collect. For the "head" revision, compute the value of the |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1221 ;; `text' printed representation by simple `gather'. For all |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1222 ;; other revisions, replace the `text' tag+value with `:insn' |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1223 ;; plus value, always scanning in-place. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1224 (if (string= context (cdr (assq 'head headers))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1225 (setcdr (cadr rev) (gather)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1226 (if @-holes |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1227 (setq asc (nreverse @-holes) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1228 sub 'incg) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1229 (setq sub 'buffer-substring-no-properties)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1230 (goto-char b) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1231 (setq acc nil) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1232 (while (< (point) e) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1233 (forward-char 1) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1234 (setq cmd (char-before) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1235 start (read (current-buffer)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1236 act (read (current-buffer))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1237 (forward-char 1) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1238 (push (case cmd |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1239 (?d |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1240 ;; `d' means "delete lines". |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1241 ;; For Emacs spirit, we use `k' for "kill". |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1242 `(,start k ,act)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1243 (?a |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1244 ;; `a' means "append after this line" but |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1245 ;; internally we normalize it so that START |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1246 ;; specifies the actual line for insert, thus |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1247 ;; requiring less hair in the realization algs. |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1248 ;; For Emacs spirit, we use `i' for "insert". |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1249 `(,(1+ start) i |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1250 ,(funcall sub (point) (progn (forward-line act) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1251 (point))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1252 (t (error "Bad command `%c' in `text' for rev `%s'" |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1253 cmd context))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1254 acc)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1255 (goto-char (1+ e)) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1256 (setcar (cdr rev) (cons :insn acc))))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1257 ;; rv |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1258 `((headers ,desc ,@headers) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1259 (revisions ,@revs))))) |
dee7926ded40
(vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56953
diff
changeset
|
1260 |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1261 (provide 'vc-rcs) |
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1262 |
56953 | 1263 ;; arch-tag: 759b4916-5b0d-431d-b647-b185b8c652cf |
31383
860d7ac182e3
(vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1264 ;;; vc-rcs.el ends here |