annotate lisp/vc-rcs.el @ 94417:1a8916b995cf

* epa-file.el (auto-encryption-mode): Rename from epa-file-mode. (epa-file-handler): Put 'safe-magic and 'operations properties. * epa.el (epa-global-minor-modes, epa-mode, epa-menu) (epa-menu-items): Remove. * epa-dired.el (epa-dired-do-decrypt, epa-dired-do-verify) (epa-dired-do-sign, epa-dired-do-encrypt): Add autoload cookie. (epa-dired-mode, epa-global-dired-mode): Remove. * dired.el (dired-mode-map): Bind encryption/decryption commands. * menu-bar.el (menu-bar-encryption-decryption-menu): New menu item. * files.el (insert-file-contents-literally): Inhibit epa-file-handler.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sun, 27 Apr 2008 19:49:15 +0000
parents 2ecb2ea8d5b5
children ad6c174910db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
73661ddc7ac7 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78519
diff changeset
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
2cc3f5b16438 Doc fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56318
diff changeset
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
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59181
diff changeset
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59181
diff changeset
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
81989
f9f0d45ce573 Add todo item.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81966
diff changeset
32 ;; TODO:
f9f0d45ce573 Add todo item.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81966
diff changeset
33 ;; - remove call to vc-expand-dirs by implementing our own (which can just
f9f0d45ce573 Add todo item.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81966
diff changeset
34 ;; list the RCS subdir instead).
f9f0d45ce573 Add todo item.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81966
diff changeset
35
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 ;;; Code:
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
38 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
39 ;;; Customization options
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
40 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
41
31840
a05558c54226 (toplevel): Require `vc' when compiling.
Gerd Moellmann <gerd@gnu.org>
parents: 31835
diff changeset
42 (eval-when-compile
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
43 (require 'cl)
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
44 (require 'vc))
31840
a05558c54226 (toplevel): Require `vc' when compiling.
Gerd Moellmann <gerd@gnu.org>
parents: 31835
diff changeset
45
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 (defcustom vc-rcs-release nil
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 "*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
48 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
49 :type '(choice (const :tag "Auto" nil)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 (string :tag "Specified")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 (const :tag "Unknown" unknown))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (defcustom vc-rcs-register-switches nil
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
55 "*Extra switches for registering a file in RCS.
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
56 A string or list of strings. These are passed to the checkin program
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
57 by \\[vc-rcs-register]."
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 :type '(choice (const :tag "None" nil)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 (string :tag "Argument String")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 (repeat :tag "Argument List"
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 :value ("")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 string))
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
63 :version "21.1"
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
66 (defcustom vc-rcs-diff-switches nil
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
67 "*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
68 :type '(choice (const :tag "None" nil)
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
69 (string :tag "Argument String")
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
70 (repeat :tag "Argument List"
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
71 :value ("")
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
72 string))
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
73 :version "21.1"
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
74 :group 'vc)
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
75
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (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
77 "*Header keywords to be inserted by `vc-insert-headers'."
35178
ae1b8d0257a7 (vc-rcs-header): Fix :type.
Dave Love <fx@gnu.org>
parents: 35133
diff changeset
78 :type '(repeat string)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
79 :version "21.1"
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (defcustom vc-rcsdiff-knows-brief nil
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 "*Indicates whether rcsdiff understands the --brief option.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 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
85 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
86 :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
87 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 ;;;###autoload
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (defcustom vc-rcs-master-templates
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 "*Where to look for RCS master files.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 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
94 :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
95 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s"))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (repeat :tag "User-specified"
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (choice string
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 function)))
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
99 :version "21.1"
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
102
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
103 ;;; Properties of the backend
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
104
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
105 (defun vc-rcs-revision-granularity ()
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
106 'file)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
107
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
108 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
109 ;;; State-querying functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
110 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
111
48282
0cae7bc9a8b8 (vc-rcs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents: 48263
diff changeset
112 ;;; 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
113 ;;; 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
114 ;;; 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
115 ;;; so that Help and etags can find it.
0cae7bc9a8b8 (vc-rcs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents: 48263
diff changeset
116
0cae7bc9a8b8 (vc-rcs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents: 48263
diff changeset
117 ;;;###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
118 (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
119
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (defun vc-rcs-state (file)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 "Implementation of `vc-state' for RCS."
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 (or (boundp 'vc-rcs-headers-result)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 (and vc-consult-headers
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (vc-rcs-consult-headers file)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (let ((state
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
126 ;; vc-working-revision might not be known; in that case the
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 ;; 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
128 ;; handle that.
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
129 (vc-rcs-fetch-master-state file
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
130 (vc-file-getprop file
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
131 'vc-working-revision))))
33636
2c1708b98891 (vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents: 33610
diff changeset
132 (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
133 state
2c1708b98891 (vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents: 33610
diff changeset
134 (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
135 'up-to-date
2c1708b98891 (vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents: 33610
diff changeset
136 (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
137 'unlocked-changes
2c1708b98891 (vc-rcs-state): Before calling vc-workfile-unchanged-p, require vc.
André Spiegel <spiegel@gnu.org>
parents: 33610
diff changeset
138 'edited)))))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 (defun vc-rcs-state-heuristic (file)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 "State heuristic for RCS."
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 (let (vc-rcs-headers-result)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 (if (and vc-consult-headers
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
144 (setq vc-rcs-headers-result
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 (vc-rcs-consult-headers file))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 (eq vc-rcs-headers-result 'rev-and-lock))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147 (let ((state (vc-file-getprop file 'vc-state)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 ;; 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
149 ;; 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
150 ;; the file or not.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 (if (and (eq state 'up-to-date)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 (not (vc-mistrust-permissions file)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 ((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
155 (vc-file-setprop file 'vc-checkout-model 'implicit)
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
156 (setq state
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
157 (if (vc-rcs-workfile-is-newer file)
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
158 'edited
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
159 'up-to-date)))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 ((string-match ".r-..-..-." (nth 8 (file-attributes file)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 (vc-file-setprop file 'vc-checkout-model 'locking))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 state)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 (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
164 (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
165 (owner-name (nth 2 attributes))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 (permissions (nth 8 attributes)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167 (cond ((string-match ".r-..-..-." permissions)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 (vc-file-setprop file 'vc-checkout-model 'locking)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 'up-to-date)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 ((string-match ".rw..-..-." permissions)
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
171 (if (eq (vc-checkout-model file) 'locking)
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
172 (if (file-ownership-preserved-p file)
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
173 'edited
68332
a6ef676caa6d (vc-rcs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents: 64762
diff changeset
174 owner-name)
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
175 (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
176 'edited
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
177 'up-to-date)))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 (t
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 ;; Strange permissions. Fall through to
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 ;; expensive state computation.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 (vc-rcs-state file))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 (vc-rcs-state file)))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183
93677
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
184 ;; XXX Experimental function for the vc-dired replacement.
94003
2ecb2ea8d5b5 Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93867
diff changeset
185 (defun vc-rcs-dir-status (dir update-function)
93677
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
186 ;; XXX: quick hack, there should be a better way to do this,
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
187 ;; but it's not worse than vc-dired :-).
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
188 (let ((flist (vc-expand-dirs (list dir)))
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
189 (result nil))
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
190 (dolist (file flist)
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
191 (let ((state (vc-state file))
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
192 (frel (file-relative-name file)))
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
193 (push (list frel state) result)))
94003
2ecb2ea8d5b5 Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93867
diff changeset
194 (funcall update-function result)))
93677
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
195
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
196 (defun vc-rcs-working-revision (file)
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
197 "RCS-specific version of `vc-working-revision'."
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
198 (or (and vc-consult-headers
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
199 (vc-rcs-consult-headers file)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
200 (vc-file-getprop file 'vc-working-revision))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
201 (progn
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
202 (vc-rcs-fetch-master-state file)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
203 (vc-file-getprop file 'vc-working-revision))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
204
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
205 (defun vc-rcs-latest-on-branch-p (file &optional version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
206 "Return non-nil if workfile version of FILE is the latest on its branch.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
207 When VERSION is given, perform check for that version."
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
208 (unless version (setq version (vc-working-revision file)))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
209 (with-temp-buffer
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
210 (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
211 (if (vc-trunk-p version)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
212 (progn
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
213 ;; Compare VERSION to the head version number.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
214 (vc-insert-file (vc-name file) "^[0-9]")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
215 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
216 ;; If we are not on the trunk, we need to examine the
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
217 ;; whole current branch.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
218 (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
219 (vc-rcs-find-most-recent-rev (vc-branch-part version))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
220
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
221 (defun vc-rcs-checkout-model (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
222 "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
223 (let (result)
b9c0ed2a46bd (vc-rcs-checkout-model): Look at the version headers only if
André Spiegel <spiegel@gnu.org>
parents: 54466
diff changeset
224 (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
225 (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
226 (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
227 (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
228 (or result
b9c0ed2a46bd (vc-rcs-checkout-model): Look at the version headers only if
André Spiegel <spiegel@gnu.org>
parents: 54466
diff changeset
229 (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
230 (vc-file-getprop file 'vc-checkout-model)))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
231
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
232 (defun vc-rcs-workfile-unchanged-p (file)
56953
2cc3f5b16438 Doc fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56318
diff changeset
233 "RCS-specific implementation of `vc-workfile-unchanged-p'."
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
234 ;; Try to use rcsdiff --brief. If rcsdiff does not understand that,
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
235 ;; do a double take and remember the fact for the future
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
236 (let* ((version (concat "-r" (vc-working-revision file)))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
237 (status (if (eq vc-rcsdiff-knows-brief 'no)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
238 (vc-do-command nil 1 "rcsdiff" file version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
239 (vc-do-command nil 2 "rcsdiff" file "--brief" version))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
240 (if (eq status 2)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
241 (if (not vc-rcsdiff-knows-brief)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
242 (setq vc-rcsdiff-knows-brief 'no
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
243 status (vc-do-command nil 1 "rcsdiff" file version))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
244 (error "rcsdiff failed"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
245 (if (not vc-rcsdiff-knows-brief) (setq vc-rcsdiff-knows-brief 'yes)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
246 ;; The workfile is unchanged if rcsdiff found no differences.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
247 (zerop status)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
248
78519
b2a41f8ce78a (vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
249 (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
250 (if (yes-or-no-p
b2a41f8ce78a (vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
251 (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
252 (file-name-nondirectory buffer-file-name)))
b2a41f8ce78a (vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
253 (save-excursion
b2a41f8ce78a (vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
254 (require 'vc)
b2a41f8ce78a (vc-rcs-find-file-not-found-hook):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
255 (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
256 (not (vc-error-occurred (vc-checkout buffer-file-name)))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
257
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
258 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
259 ;;; State-changing functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
260 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
261
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
262 (defun vc-rcs-create-repo ()
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
263 "Create a new RCS repository."
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
264 ;; RCS is totally file-oriented, so all we have to do is make the directory
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
265 (make-directory "RCS"))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
266
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
267 (defun vc-rcs-register (files &optional rev comment)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
268 "Register FILES into the RCS version-control system.
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
269 REV is the optional revision number for the files. COMMENT can be used
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
270 to provide an initial description for each FILES.
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
271
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
272 `vc-register-switches' and `vc-rcs-register-switches' are passed to
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
273 the RCS command (in that order).
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
274
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
275 Automatically retrieve a read-only version of the file with keywords
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
276 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
92165
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
277 (let (subdir name)
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
278 (dolist (file files)
92165
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
279 (and (not (file-exists-p
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
280 (setq subdir (expand-file-name "RCS"
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
281 (file-name-directory file)))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
282 (not (directory-files (file-name-directory file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
283 nil ".*,v$" t))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
284 (yes-or-no-p "Create RCS subdirectory? ")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
285 (make-directory subdir))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
286 (apply 'vc-do-command nil 0 "ci" file
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
287 ;; if available, use the secure registering option
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
288 (and (vc-rcs-release-p "5.6.4") "-i")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
289 (concat (if vc-keep-workfiles "-u" "-r") rev)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
290 (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
291 (vc-switches 'RCS 'register))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
292 ;; parse output to find master file name and workfile version
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
293 (with-current-buffer "*vc*"
92165
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
294 (goto-char (point-min))
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
295 (if (not (setq name
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
296 (if (looking-at (concat "^\\(.*\\) <-- "
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
297 (file-name-nondirectory file)))
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
298 (match-string 1))))
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
299 ;; if we couldn't find the master name,
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
300 ;; run vc-rcs-registered to get it
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
301 ;; (will be stored into the vc-name property)
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
302 (vc-rcs-registered file)
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
303 (vc-file-setprop file 'vc-name
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
304 (if (file-name-absolute-p name)
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
305 name
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
306 (expand-file-name
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
307 name
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
308 (file-name-directory file))))))
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
309 (vc-file-setprop file 'vc-working-revision
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
310 (if (re-search-forward
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
311 "^initial revision: \\([0-9.]+\\).*\n"
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
312 nil t)
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
313 (match-string 1))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
314
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
315 (defun vc-rcs-responsible-p (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
316 "Return non-nil if RCS thinks it would be responsible for registering FILE."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
317 ;; TODO: check for all the patterns in vc-rcs-master-templates
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
318 (file-directory-p (expand-file-name "RCS" (file-name-directory file))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
319
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
320 (defun vc-rcs-receive-file (file rev)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
321 "Implementation of receive-file for RCS."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
322 (let ((checkout-model (vc-checkout-model file)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
323 (vc-rcs-register file rev "")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
324 (when (eq checkout-model 'implicit)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
325 (vc-rcs-set-non-strict-locking file))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
326 (vc-rcs-set-default-branch file (concat rev ".1"))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
327
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
328 (defun vc-rcs-unregister (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
329 "Unregister FILE from RCS.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
330 If this leaves the RCS subdirectory empty, ask the user
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
331 whether to remove it."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
332 (let* ((master (vc-name file))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
333 (dir (file-name-directory master))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
334 (backup-info (find-backup-file-name master)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
335 (if (not backup-info)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
336 (delete-file master)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
337 (rename-file master (car backup-info) 'ok-if-already-exists)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
338 (dolist (f (cdr backup-info)) (ignore-errors (delete-file f))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
339 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
340 ;; check whether RCS dir is empty, i.e. it does not
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
341 ;; contain any files except "." and ".."
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
342 (not (directory-files dir nil
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
343 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
344 (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
345 (delete-directory dir))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
346
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
347 (defun vc-rcs-checkin (files rev comment)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
348 "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
349 (let ((switches (vc-switches 'RCS 'checkin)))
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
350 ;; Now operate on the files
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
351 (dolist (file files)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
352 (let ((old-version (vc-working-revision file)) new-version
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
353 (default-branch (vc-file-getprop file 'vc-rcs-default-branch)))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
354 ;; Force branch creation if an appropriate
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
355 ;; default branch has been set.
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
356 (and (not rev)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
357 default-branch
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
358 (string-match (concat "^" (regexp-quote old-version) "\\.")
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
359 default-branch)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
360 (setq rev default-branch)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
361 (setq switches (cons "-f" switches)))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
362 (if (and (not rev) old-version)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
363 (setq rev (vc-branch-part old-version)))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
364 (apply 'vc-do-command nil 0 "ci" (vc-name file)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
365 ;; if available, use the secure check-in option
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
366 (and (vc-rcs-release-p "5.6.4") "-j")
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
367 (concat (if vc-keep-workfiles "-u" "-r") rev)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
368 (concat "-m" comment)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
369 switches)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
370 (vc-file-setprop file 'vc-working-revision nil)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
371
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
372 ;; determine the new workfile version
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
373 (set-buffer "*vc*")
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
374 (goto-char (point-min))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
375 (when (or (re-search-forward
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
376 "new revision: \\([0-9.]+\\);" nil t)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
377 (re-search-forward
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
378 "reverting to previous revision \\([0-9.]+\\)" nil t))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
379 (setq new-version (match-string 1))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
380 (vc-file-setprop file 'vc-working-revision new-version))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
381
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
382 ;; if we got to a different branch, adjust the default
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
383 ;; branch accordingly
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
384 (cond
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
385 ((and old-version new-version
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
386 (not (string= (vc-branch-part old-version)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
387 (vc-branch-part new-version))))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
388 (vc-rcs-set-default-branch file
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
389 (if (vc-trunk-p new-version) nil
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
390 (vc-branch-part new-version)))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
391 ;; If this is an old RCS release, we might have
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
392 ;; to remove a remaining lock.
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
393 (if (not (vc-rcs-release-p "5.6.2"))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
394 ;; exit status of 1 is also accepted.
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
395 ;; It means that the lock was removed before.
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
396 (vc-do-command nil 1 "rcs" (vc-name file)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
397 (concat "-u" old-version)))))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
398
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
399 (defun vc-rcs-find-revision (file rev buffer)
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
400 (apply 'vc-do-command
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
401 buffer 0 "co" (vc-name file)
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
402 "-q" ;; suppress diagnostic output
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
403 (concat "-p" rev)
50903
c03b80e1bacd (vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49597
diff changeset
404 (vc-switches 'RCS 'checkout)))
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
405
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
406 (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
407 "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
408 (let ((file-buffer (get-file-buffer file))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
409 switches)
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
410 (message "Checking out %s..." file)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
411 (save-excursion
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
412 ;; Change buffers to get local value of vc-checkout-switches.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
413 (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
414 (setq switches (vc-switches 'RCS 'checkout))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
415 ;; Save this buffer's default-directory
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
416 ;; and use save-excursion to make sure it is restored
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
417 ;; in the same buffer it was saved in.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
418 (let ((default-directory default-directory))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
419 (save-excursion
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
420 ;; Adjust the default-directory so that the check-out creates
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
421 ;; the file in the right place.
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
422 (setq default-directory (file-name-directory file))
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
423 (let (new-version)
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
424 ;; 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
425 ;; clear the default branch first
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
426 (and rev (string= rev "")
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
427 (vc-rcs-set-default-branch file nil))
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
428 ;; now do the checkout
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
429 (apply 'vc-do-command
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
430 nil 0 "co" (vc-name file)
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
431 ;; 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
432 ;; the writable workfile.
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
433 (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
434 (if editable "-l")
48966
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
435 (if (stringp rev)
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
436 ;; a literal revision was specified
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
437 (concat "-r" rev)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
438 (let ((workrev (vc-working-revision file)))
48966
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
439 (if workrev
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
440 (concat "-r"
48966
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
441 (if (not rev)
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
442 ;; no revision specified:
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
443 ;; use current workfile version
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
444 workrev
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
445 ;; 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
446 (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
447 ;; ... go to head of current branch
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
448 (vc-branch-part workrev)
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
449 ;; ... go to head of trunk
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
450 (vc-rcs-set-default-branch file
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
451 nil)
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
452 ""))))))
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
453 switches)
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
454 ;; determine the new workfile version
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
455 (with-current-buffer "*vc*"
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
456 (setq new-version
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
457 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1)))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
458 (vc-file-setprop file 'vc-working-revision new-version)
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
459 ;; if necessary, adjust the default branch
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
460 (and rev (not (string= rev ""))
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
461 (vc-rcs-set-default-branch
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
462 file
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
463 (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
464 (if (vc-trunk-p new-version) nil
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
465 (vc-branch-part new-version))
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
466 new-version)))))
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
467 (message "Checking out %s...done" file)))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
468
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
469 (defun vc-rcs-rollback (files)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
470 "Roll back, undoing the most recent checkins of FILES."
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
471 (if (not files)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
472 (error "RCS backend doesn't support directory-level rollback."))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
473 (dolist (file files)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
474 (let* ((discard (vc-working-revision file))
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
475 (previous (if (vc-trunk-p discard) "" (vc-branch-part discard)))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
476 (config (current-window-configuration))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
477 (done nil))
91955
e3aedad81f5f Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 87649
diff changeset
478 (if (null (yes-or-no-p (format "Remove version %s from %s history? "
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
479 discard file)))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
480 (error "Aborted"))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
481 (message "Removing revision %s from %s." discard file)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
482 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" discard))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
483 ;; Check out the most recent remaining version. If it
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
484 ;; fails, because the whole branch got deleted, do a
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
485 ;; double-take and check out the version where the branch
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
486 ;; started.
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
487 (while (not done)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
488 (condition-case err
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
489 (progn
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
490 (vc-do-command nil 0 "co" (vc-name file) "-f"
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
491 (concat "-u" previous))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
492 (setq done t))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
493 (error (set-buffer "*vc*")
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
494 (goto-char (point-min))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
495 (if (search-forward "no side branches present for" nil t)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
496 (progn (setq previous (vc-branch-part previous))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
497 (vc-rcs-set-default-branch file previous)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
498 ;; vc-do-command popped up a window with
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
499 ;; the error message. Get rid of it, by
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
500 ;; restoring the old window configuration.
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
501 (set-window-configuration config))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
502 ;; No, it was some other error: re-signal it.
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
503 (signal (car err) (cdr err)))))))))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
504
39001
d13c2139752b (vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents: 38436
diff changeset
505 (defun vc-rcs-revert (file &optional contents-done)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
506 "Revert FILE to the version it was based on."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
507 (vc-do-command nil 0 "co" (vc-name file) "-f"
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
508 (concat (if (eq (vc-state file) 'edited) "-u" "-r")
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
509 (vc-working-revision file))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
510
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
511 (defun vc-rcs-merge (file first-version &optional second-version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
512 "Merge changes into current working copy of FILE.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
513 The changes are between FIRST-VERSION and SECOND-VERSION."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
514 (vc-do-command nil 1 "rcsmerge" (vc-name file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
515 "-kk" ; ignore keyword conflicts
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
516 (concat "-r" first-version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
517 (if second-version (concat "-r" second-version))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
518
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
519 (defun vc-rcs-steal-lock (file &optional rev)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
520 "Steal the lock on the current workfile for FILE and revision REV.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
521 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
522 (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
523 ;; 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
524 ;; 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
525 (vc-do-command nil 0 "co" (vc-name file) "-f" (concat "-l" rev)))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
526
87432
315124ffb889 * (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
527 (defun vc-rcs-modify-change-comment (files rev comment)
315124ffb889 * (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
528 "Modify the change comments change on FILES on a specified REV."
315124ffb889 * (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 85139
diff changeset
529 (dolist (file files)
91955
e3aedad81f5f Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 87649
diff changeset
530 (vc-do-command nil 0 "rcs" (vc-name file)
93867
520490ae1b9a * vc-rcs.el (vc-rcs-modify-change-comment):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 93677
diff changeset
531 (concat "-m" rev ":" comment))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
532
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
533
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
534 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
535 ;;; History functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
536 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
537
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
538 (defun vc-rcs-print-log (files &optional buffer)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
539 "Get change log associated with FILE."
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
540 (vc-do-command buffer 0 "rlog" (mapcar 'vc-name files)))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
541
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
542 (defun vc-rcs-diff (files &optional oldvers newvers buffer)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
543 "Get a difference report using RCS between two sets of files."
91955
e3aedad81f5f Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 87649
diff changeset
544 (apply 'vc-do-command (or buffer "*vc-diff*")
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
545 1 ;; Always go synchronous, the repo is local
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
546 "rcsdiff" (vc-expand-dirs files)
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
547 (append (list "-q"
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
548 (and oldvers (concat "-r" oldvers))
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
549 (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
550 (vc-switches 'RCS 'diff))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
551
81966
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
552 (defun vc-rcs-wash-log ()
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
553 "Remove all non-comment information from log output."
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
554 (let ((separator (concat "^-+\nrevision [0-9.]+\ndate: .*\n"
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
555 "\\(branches: .*;\n\\)?"
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
556 "\\(\\*\\*\\* empty log message \\*\\*\\*\n\\)?")))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
557 (goto-char (point-max)) (forward-line -1)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
558 (while (looking-at "=*\n")
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
559 (delete-char (- (match-end 0) (match-beginning 0)))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
560 (forward-line -1))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
561 (goto-char (point-min))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
562 (if (looking-at "[\b\t\n\v\f\r ]+")
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
563 (delete-char (- (match-end 0) (match-beginning 0))))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
564 (goto-char (point-min))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
565 (re-search-forward separator nil t)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
566 (delete-region (point-min) (point))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
567 (while (re-search-forward separator nil t)
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
568 (delete-region (match-beginning 0) (match-end 0)))))
cedd5b77aae4 Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 76694
diff changeset
569
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
570 (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
571 "Annotate FILE, inserting the results in BUFFER.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
572 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
573 (vc-setup-buffer buffer)
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
574 ;; 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
575 ;; 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
576 ;; commands necessary to go from the chronologically-following
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
577 ;; 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
578 ;; 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
579 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
580 ;; 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
581 ;; 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
582 ;; 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
583 ;; 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
584 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
585 ;; 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
586 ;; 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
587 ;; 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
588 ;; 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
589 ;; 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
590 ;; 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
591 ;; or on a branch).
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
592 (let* ((tree (with-temp-buffer
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
593 (insert-file-contents (vc-rcs-registered file))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
594 (vc-rcs-parse)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
595 (revisions (cdr (assq 'revisions tree)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
596 ;; 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
597 (cur (cdr (assq 'head (cdr (assq 'headers tree)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
598 ;; Alist from the parse tree for N.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
599 (meta (cdr (assoc cur revisions)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
600 ;; Point and temporary string, respectively.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
601 p s
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
602 ;; "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
603 ;; 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
604 ;; 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
605 ;; (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
606 ;; 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
607 ;; revision to the desired revision to display.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
608 nbls
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
609 ;; "Path-accumulate-predicate plus revision/date/author".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
610 ;; Until set, forward-chronological edits are not accumulated.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
611 ;; 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
612 ;; 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
613 ;; processing of forward-chronological instructions for N.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
614 ;; See internal func `r/d/a'.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
615 prda
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
616 ;; List of forward-chronological instructions, each of the
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
617 ;; 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
618 ;; 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
619 ;; the number of characters to be deleted.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
620 path
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
621 ;; 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
622 pre)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
623 (unless revision
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
624 (setq revision cur))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
625 (unless (assoc revision revisions)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
626 (error "No such revision: %s" revision))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
627 ;; 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
628 (let ((par revision)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
629 bpt kids)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
630 (while (setq bpt (vc-branch-part par)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
631 par (vc-branch-part bpt))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
632 (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
633 ;; 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
634 (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
635 (setq kids (cdr kids)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
636 (push (cons par (car kids)) nbls)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
637 ;; Start with the full text.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
638 (set-buffer buffer)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
639 (insert (cdr (assq 'text meta)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
640 ;; 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
641 ;; accumulating forward-chronological edits after some point, for
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
642 ;; later.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
643 (flet ((r/d/a () (vector pre
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
644 (cdr (assq 'date meta))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
645 (cdr (assq 'author meta)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
646 (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
647 (not (string= "" cur)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
648 (setq
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
649 ;; 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
650 ;; 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
651 ;; the appropriate branchpoint for it. Do this before
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
652 ;; 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
653 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
654 (r/d/a))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
655 meta (cdr (assoc cur revisions)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
656 ;; 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
657 ;; *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
658 ;; 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
659 ;; 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
660 ;; 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
661 ;; 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
662 ;; 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
663 ;; 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
664 ;; 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
665 (dolist (insn (cdr (assq :insn meta)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
666 (goto-line (pop insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
667 (setq p (point))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
668 (case (pop insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
669 (k (setq s (buffer-substring-no-properties
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
670 p (progn (forward-line (car insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
671 (point))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
672 (when prda
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
673 (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
674 (delete-region p (point)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
675 (i (setq s (car insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
676 (when prda
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
677 (push `(,p . ,(length s)) path))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
678 (insert s)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
679 ;; 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
680 ;; 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
681 ;; 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
682 (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
683 ;; 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
684 (dolist (insn path)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
685 (goto-char (pop insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
686 (if (stringp insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
687 (insert insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
688 (delete-char insn)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
689 ;; 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
690 ;; 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
691 ;; `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
692 (while nbls
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
693 (setq pre (cdr (pop nbls)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
694 (while (progn
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
695 (setq meta (cdr (assoc pre revisions))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
696 prda nil)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
697 (dolist (insn (cdr (assq :insn meta)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
698 (goto-line (pop insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
699 (case (pop insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
700 (k (delete-region
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
701 (point) (progn (forward-line (car insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
702 (point))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
703 (i (insert (propertize
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
704 (car insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
705 :vc-rcs-r/d/a
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
706 (or prda (setq prda (r/d/a))))))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
707 (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
708 (setq pre (cdr (assq 'next meta)))))))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
709 ;; 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
710 ;; 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
711 ;; 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
712 ;; 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
713 ;; 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
714 (let ((ht (make-hash-table :test 'eq))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
715 (me (user-login-name))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
716 (maxw 0)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
717 (all-me t)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
718 rda w a)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
719 (goto-char (point-max))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
720 (while (not (bobp))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
721 (forward-line -1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
722 (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
723 (unless (gethash rda ht)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
724 (setq a (aref rda 2)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
725 all-me (and all-me (string= a me)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
726 (puthash rda (setq w (+ (length (aref rda 0))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
727 (length a)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
728 ht)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
729 (setq maxw (max w maxw))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
730 (let ((padding (make-string maxw 32)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
731 (flet ((pad (w) (substring-no-properties padding w))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
732 (render (rda &rest ls)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
733 (propertize
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
734 (apply 'concat
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
735 (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
736 " "
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
737 (aref rda 0)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
738 ls)
76694
f35ed3fecce9 (vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 75347
diff changeset
739 :vc-annotate-prefix t
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
740 :vc-rcs-r/d/a rda)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
741 (maphash
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
742 (if all-me
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
743 (lambda (rda w)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
744 (puthash rda (render rda (pad w) ": ") ht))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
745 (lambda (rda w)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
746 (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
747 ht)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
748 (while (not (eobp))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
749 (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
750 (forward-line 1))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
751
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
752 (defun vc-rcs-annotate-current-time ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
753 "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
754 encoded as fractional days."
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
755 (vc-annotate-convert-time
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
756 (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
757
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
758 (defun vc-rcs-annotate-time ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
759 "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
760 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
761 (unless (eobp)
76694
f35ed3fecce9 (vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 75347
diff changeset
762 (prog1 (vc-annotate-convert-time
f35ed3fecce9 (vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 75347
diff changeset
763 (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
764 (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
765
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
766 (defun vc-rcs-annotate-extract-revision-at-line ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
767 (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
768
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
769
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
770 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
771 ;;; Snapshot system
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
772 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
773
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
774 (defun vc-rcs-assign-name (file name)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
775 "Assign to FILE's latest version a given NAME."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
776 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-n" name ":")))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
777
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
778
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
779 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
780 ;;; Miscellaneous
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
781 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
782
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
783 (defun vc-rcs-check-headers ()
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
784 "Check if the current file has any headers in it."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
785 (save-excursion
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
786 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
787 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
788 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
789
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
790 (defun vc-rcs-clear-headers ()
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
791 "Implementation of vc-clear-headers for RCS."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
792 (let ((case-fold-search nil))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
793 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
794 (while (re-search-forward
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
795 (concat "\\$\\(Author\\|Date\\|Header\\|Id\\|Locker\\|Name\\|"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
796 "RCSfile\\|Revision\\|Source\\|State\\): [^$\n]+\\$")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
797 nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
798 (replace-match "$\\1$"))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
799
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
800 (defun vc-rcs-rename-file (old new)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
801 ;; Just move the master file (using vc-rcs-master-templates).
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
802 (vc-rename-master (vc-name old) new vc-rcs-master-templates))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
803
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
804
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
805 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
806 ;;; Internal functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
807 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
808
91956
7bc22dad5f9a Make sure all backends support vc-BACKEND-root.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91955
diff changeset
809 (defun vc-rcs-root (dir)
7bc22dad5f9a Make sure all backends support vc-BACKEND-root.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91955
diff changeset
810 (vc-find-root dir "RCS" t))
7bc22dad5f9a Make sure all backends support vc-BACKEND-root.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 91955
diff changeset
811
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
812 (defun vc-rcs-workfile-is-newer (file)
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
813 "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
814 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
815 to its master version."
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
816 (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
817 (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
818 (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
819 (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
820 (> (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
821
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
822 (defun vc-rcs-find-most-recent-rev (branch)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
823 "Find most recent revision on BRANCH."
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
824 (goto-char (point-min))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
825 (let ((latest-rev -1) value)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
826 (while (re-search-forward (concat "^\\(" (regexp-quote branch)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
827 "\\.\\([0-9]+\\)\\)\ndate[ \t]+[0-9.]+;")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
828 nil t)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
829 (let ((rev (string-to-number (match-string 2))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
830 (when (< latest-rev rev)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
831 (setq latest-rev rev)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
832 (setq value (match-string 1)))))
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
833 (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
834 (vc-branch-part branch))))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
835
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
836 (defun vc-rcs-fetch-master-state (file &optional working-revision)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
837 "Compute the master file's idea of the state of FILE.
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
838 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
839 otherwise determine the workfile version based on the master file.
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
840 This function sets the properties `vc-working-revision' and
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
841 `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
842 file."
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
843 (with-temp-buffer
46543
7fa004ccd462 (vc-rcs-fetch-master-state): Be more careful to check
André Spiegel <spiegel@gnu.org>
parents: 44004
diff changeset
844 (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
845 (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
846 (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
847 (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
848 (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
849 (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
850 (vc-file-setprop file 'vc-rcs-default-branch default-branch)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
851 (unless working-revision
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
852 ;; 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
853 ;; 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
854 ;; 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
855 ;; revision number.
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
856 (cond
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
857 ;; no default branch
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
858 ((or (not default-branch) (string= "" default-branch))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
859 (setq working-revision
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
860 (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
861 (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
862 ;; 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
863 ((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
864 default-branch)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
865 (setq working-revision default-branch))
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
866 ;; 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
867 (t (vc-insert-file (vc-name file) "^desc")
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
868 (setq working-revision
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
869 (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
870 (setq workfile-is-latest t)))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
871 (vc-file-setprop file 'vc-working-revision working-revision))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
872 ;; Check strict locking
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
873 (goto-char (point-min))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
874 (vc-file-setprop file 'vc-checkout-model
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
875 (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
876 'locking 'implicit))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
877 ;; Compute state of workfile version
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
878 (goto-char (point-min))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
879 (let ((locking-user
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
880 (vc-parse-buffer (concat "^locks[ \t\n]+[^;]*[ \t\n]+\\([^:]+\\):"
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
881 (regexp-quote working-revision)
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
882 "[^0-9.]")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
883 1)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
884 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
885 ;; not locked
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
886 ((not locking-user)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
887 (if (or workfile-is-latest
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
888 (vc-rcs-latest-on-branch-p file working-revision))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
889 ;; 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
890 'up-to-date
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
891 ;; workfile version is not latest on branch
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
892 'needs-patch))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
893 ;; locked by the calling user
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
894 ((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
895 (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
896 (if (or (eq (vc-checkout-model file) 'locking)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
897 workfile-is-latest
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
898 (vc-rcs-latest-on-branch-p file working-revision))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
899 'edited
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
900 ;; 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
901 ;; 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
902 ;; 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
903 ;; to use `needs-merge' in this case.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
904 'needs-merge))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
905 ;; locked by somebody else
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
906 ((stringp locking-user)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
907 locking-user)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
908 (t
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
909 (error "Error getting state of RCS file")))))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
910
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
911 (defun vc-rcs-consult-headers (file)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
912 "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
913
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
914 Returns: nil if no headers were found
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
915 'rev if a workfile revision was found
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
916 '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
917 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
918 ((not (get-file-buffer file)) nil)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
919 ((let (status version locking-user)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
920 (save-excursion
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
921 (set-buffer (get-file-buffer file))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
922 (goto-char (point-min))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
923 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
924 ;; search for $Id or $Header
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
925 ;; -------------------------
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
926 ;; 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
927 ((or (and (search-forward "$Id\ : " nil t)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
928 (looking-at "[^ ]+ \\([0-9.]+\\) "))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
929 (and (progn (goto-char (point-min))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
930 (search-forward "$Header\ : " nil t))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
931 (looking-at "[^ ]+ \\([0-9.]+\\) ")))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
932 (goto-char (match-end 0))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
933 ;; if found, store the revision number ...
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
934 (setq version (match-string-no-properties 1))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
935 ;; ... and check for the locking state
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
936 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
937 ((looking-at
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
938 (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
939 "[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
940 "[^ ]+ [^ ]+ ")) ; author & state
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
941 (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
942 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
943 ;; unlocked revision
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
944 ((looking-at "\\$")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
945 (setq locking-user 'none)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
946 (setq status 'rev-and-lock))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
947 ;; revision is locked by some user
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
948 ((looking-at "\\([^ ]+\\) \\$")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
949 (setq locking-user (match-string-no-properties 1))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
950 (setq status 'rev-and-lock))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
951 ;; everything else: false
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
952 (nil)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
953 ;; unexpected information in
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
954 ;; keyword string --> quit
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
955 (nil)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
956 ;; search for $Revision
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
957 ;; --------------------
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
958 ((re-search-forward (concat "\\$"
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
959 "Revision: \\([0-9.]+\\) \\$")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
960 nil t)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
961 ;; if found, store the revision number ...
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
962 (setq version (match-string-no-properties 1))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
963 ;; and see if there's any lock information
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
964 (goto-char (point-min))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
965 (if (re-search-forward (concat "\\$" "Locker:") nil t)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
966 (cond ((looking-at " \\([^ ]+\\) \\$")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
967 (setq locking-user (match-string-no-properties 1))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
968 (setq status 'rev-and-lock))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
969 ((looking-at " *\\$")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
970 (setq locking-user 'none)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
971 (setq status 'rev-and-lock))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
972 (t
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
973 (setq locking-user 'none)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
974 (setq status 'rev-and-lock)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
975 (setq status 'rev)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
976 ;; else: nothing found
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
977 ;; -------------------
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
978 (t nil)))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
979 (if status (vc-file-setprop file 'vc-working-revision version))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
980 (and (eq status 'rev-and-lock)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
981 (vc-file-setprop file 'vc-state
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
982 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
983 ((eq locking-user 'none) 'up-to-date)
76694
f35ed3fecce9 (vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 75347
diff changeset
984 ((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
985 'edited)
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
986 (t locking-user)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
987 ;; 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
988 ;; master file, because that would eliminate all the
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
989 ;; performance gain the headers brought us. We therefore
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
990 ;; 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
991 ;; 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
992 ;; 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
993 ;; 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
994 ;; locking is not used.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
995 (not (vc-mistrust-permissions file))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
996 (vc-up-to-date-p file)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
997 (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
998 (vc-file-setprop file 'vc-checkout-model 'locking)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
999 (vc-file-setprop file 'vc-checkout-model 'implicit)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1000 status))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1001
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1002 (defun vc-release-greater-or-equal (r1 r2)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1003 "Compare release numbers, represented as strings.
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1004 Release components are assumed cardinal numbers, not decimal fractions
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1005 \(5.10 is a higher release than 5.9\). Omitted fields are considered
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1006 lower \(5.6.7 is earlier than 5.6.7.1\). Comparison runs till the end
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1007 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
1008 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
1009 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
1010 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
1011 (let (v1 v2 i1 i2)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1012 (catch 'done
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1013 (or (and (string-match "^\\.?\\([0-9]+\\)" r1)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1014 (setq i1 (match-end 0))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1015 (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
1016 (or (and (string-match "^\\.?\\([0-9]+\\)" r2)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1017 (setq i2 (match-end 0))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1018 (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
1019 (if (> v1 v2) (throw 'done t)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1020 (if (< v1 v2) (throw 'done nil)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1021 (throw 'done
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1022 (vc-release-greater-or-equal
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1023 (substring r1 i1)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1024 (substring r2 i2)))))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1025 (throw 'done t)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1026 (or (and (string-match "^\\.?\\([0-9]+\\)" r2)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1027 (throw 'done nil))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1028 (throw 'done t)))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1029
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1030 (defun vc-rcs-release-p (release)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1031 "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
1032 (let ((installation (vc-rcs-system-release)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1033 (if (and installation
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1034 (not (eq installation 'unknown)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1035 (vc-release-greater-or-equal installation release))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1036
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1037 (defun vc-rcs-system-release ()
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1038 "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
1039 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
1040 override this using variable `vc-rcs-release'.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1041
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1042 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
1043 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
1044 (or vc-rcs-release
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1045 (setq vc-rcs-release
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1046 (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
1047 (with-current-buffer (get-buffer "*vc*")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1048 (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1049 'unknown))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1050
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
1051 (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
1052 (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
1053 (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
1054 (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
1055
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
1056 (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
1057 (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
1058 (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
1059
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1060 (defun vc-rcs-parse (&optional buffer)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1061 "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
1062 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
1063 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
1064 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
1065 strings and the keys are:
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1066
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1067 desc -- description
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1068 head -- latest revision
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1069 branch -- the branch the \"head revision\" lies on;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1070 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
1071 access -- ???
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1072 symbols -- sub-alist of (SYMBOL . REVISION) elements
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1073 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
1074 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
1075 comment -- may be absent; typically something like \"# \" or \"; \"
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1076 expand -- may be absent; ???
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1077
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1078 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
1079 with string values (unless otherwise specified) and keys:
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1080
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1081 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
1082 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
1083 author -- username
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1084 state -- typically \"Exp\" or \"Rel\"
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1085 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
1086 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
1087 on a branch: the chronologically-following revision, or \"\"
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1088 log -- change log entry
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1089 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
1090 other revisions have `:insn' instead
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1091 :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
1092 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
1093 go to line START\":
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1094 - `(START k COUNT)' -- kill COUNT lines
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1095 - `(START i TEXT)' -- insert TEXT (a string)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1096 The list is in descending order by START.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1097
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1098 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
1099 (setq buffer (get-buffer (or buffer (current-buffer))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1100 (set-buffer buffer)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1101 ;; 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
1102 ;; 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
1103 ;; 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
1104 ;; 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
1105 ;; 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
1106 ;; (c) are simply combined to form the "headers".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1107 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1108 ;; 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
1109 ;; "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
1110 ;; 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
1111 ;; 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
1112 ;; with it.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1113 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1114 ;; 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
1115 ;; 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
1116 ;; 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
1117 ;; 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
1118 ;; 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
1119 ;; 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
1120 ;; 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
1121 ;; initial step when translating to the value).
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1122 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1123 ;; 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
1124 (let ((desc nil) (headers nil) (revs nil)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1125 ;; ... 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
1126 ;; minimal-data-copying scan. Basically -- skirting around the
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1127 ;; 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
1128 ;; 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
1129 ;; determine the bounds of the printed representation, translate
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1130 ;; 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
1131 ;; collection vars. Finally, we return the parse tree
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1132 ;; 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
1133 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1134 ;; 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
1135 context
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1136 ;; A symbol, the current tag.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1137 tok
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1138 ;; 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
1139 ;; representation for the current tag.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1140 b e
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1141 ;; 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
1142 ;; 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
1143 ;; 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
1144 ;; 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
1145 ;; `(,e ,@@-holes ,b)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1146 ;; 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
1147 ;; 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
1148 ;; 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
1149 @-holes)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1150 (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
1151 (at (tag) (save-excursion (eq tag (read buffer))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1152 (to-eol () (buffer-substring-no-properties
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1153 (point) (progn (forward-line 1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1154 (1- (point)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1155 (to-semi () (setq b (point)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1156 e (progn (search-forward ";")
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1157 (1- (point)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1158 (to-one@ () (setq @-holes nil
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1159 b (progn (search-forward "@") (point))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1160 e (progn (while (and (search-forward "@")
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1161 (= ?@ (char-after))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1162 (progn
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1163 (push (point) @-holes)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1164 (forward-char 1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1165 (push (point) @-holes))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1166 (1- (point)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1167 (tok+val (set-b+e name &optional proc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1168 (unless (eq name (setq tok (read buffer)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1169 (error "Missing `%s' while parsing %s" name context))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1170 (sw)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1171 (funcall set-b+e)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1172 (cons tok (if proc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1173 (funcall proc)
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 (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
1176 (gather () (let ((pairs `(,e ,@@-holes ,b))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1177 acc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1178 (while pairs
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1179 (push (buffer-substring-no-properties
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1180 (cadr pairs) (car pairs))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1181 acc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1182 (setq pairs (cddr pairs)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1183 (apply 'concat acc)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1184 (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
1185 (if later
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1186 (lambda () t)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1187 'gather))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1188 (save-excursion
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1189 (goto-char (point-min))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1190 ;; headers
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1191 (setq context 'headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1192 (flet ((hpush (name &optional proc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1193 (push (k-semi name proc) headers)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1194 (hpush 'head)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1195 (when (at 'branch)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1196 (hpush 'branch))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1197 (hpush 'access)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1198 (hpush 'symbols
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1199 (lambda ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1200 (mapcar (lambda (together)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1201 (let ((two (split-string together ":")))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1202 (setcar two (intern (car two)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1203 (setcdr two (cadr two))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1204 two))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1205 (split-string
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1206 (buffer-substring-no-properties b e)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1207 (hpush 'locks))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1208 (push `(strict . ,(when (at 'strict)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1209 (search-forward ";")
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1210 t))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1211 headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1212 (when (at 'comment)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1213 (push (k-one@ 'comment) headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1214 (search-forward ";"))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1215 (when (at 'expand)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1216 (push (k-one@ 'expand) headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1217 (search-forward ";"))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1218 (setq headers (nreverse headers))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1219 ;; rev headers
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1220 (sw) (setq context 'rev-headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1221 (while (looking-at "[0-9]")
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1222 (push `(,(to-eol)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1223 ,(k-semi 'date
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1224 (lambda ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1225 (let ((ls (mapcar 'string-to-number
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1226 (split-string
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1227 (buffer-substring-no-properties
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1228 b e)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1229 "\\."))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1230 ;; Hack the year -- verified to be the
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1231 ;; same algorithm used in RCS 5.7.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1232 (when (< (car ls) 100)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1233 (setcar ls (+ 1900 (car ls))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1234 (apply 'encode-time (nreverse ls)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1235 ,@(mapcar 'k-semi '(author state))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1236 ,(k-semi 'branches
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1237 (lambda ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1238 (split-string
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1239 (buffer-substring-no-properties b e))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1240 ,(k-semi 'next))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1241 revs)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1242 (sw))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1243 (setq revs (nreverse revs))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1244 ;; desc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1245 (sw) (setq context 'desc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1246 desc (k-one@ 'desc))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1247 ;; rev bodies
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1248 (let (acc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1249 ;; 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
1250 ;; "Pairwise combination" occurs when we add body info.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1251 rev
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1252 ;; 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
1253 ;; text) that comprise the `text' printed representations
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1254 ;; (not including the "head" revision).
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1255 cmd start act
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1256 ;; Ascending (reversed) `@-holes' which the internal func
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1257 ;; `incg' pops to effect incremental gathering.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1258 asc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1259 ;; 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
1260 ;; `incg' or `buffer-substring-no-properties'. (This is
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1261 ;; 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
1262 ;; 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
1263 ;; latter in the absense of "@@".)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1264 sub)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1265 (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
1266 (while (and asc (< (car asc) e))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1267 (push (pop asc) @-holes))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1268 ;; Self-deprecate when work is done.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1269 ;; Folding many dimensions into one.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1270 ;; Thanks B.Mandelbrot, for complex sum.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1271 ;; O beauteous math! --the Unvexed Bum
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1272 (unless asc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1273 (setq sub 'buffer-substring-no-properties))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1274 (gather))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1275 (while (and (sw)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1276 (not (eobp))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1277 (setq context (to-eol)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1278 rev (or (assoc context revs)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1279 (error "Rev `%s' has body but no head"
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1280 context))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1281 (push (k-one@ 'log) (cdr rev))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1282 ;; For rev body `text' tags, delay translation slightly...
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1283 (push (k-one@ 'text t) (cdr rev))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1284 ;; ... 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
1285 ;; 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
1286 ;; `text' printed representation by simple `gather'. For all
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1287 ;; 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
1288 ;; plus value, always scanning in-place.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1289 (if (string= context (cdr (assq 'head headers)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1290 (setcdr (cadr rev) (gather))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1291 (if @-holes
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1292 (setq asc (nreverse @-holes)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1293 sub 'incg)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1294 (setq sub 'buffer-substring-no-properties))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1295 (goto-char b)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1296 (setq acc nil)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1297 (while (< (point) e)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1298 (forward-char 1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1299 (setq cmd (char-before)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1300 start (read (current-buffer))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1301 act (read (current-buffer)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1302 (forward-char 1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1303 (push (case cmd
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1304 (?d
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1305 ;; `d' means "delete lines".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1306 ;; For Emacs spirit, we use `k' for "kill".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1307 `(,start k ,act))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1308 (?a
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1309 ;; `a' means "append after this line" but
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1310 ;; internally we normalize it so that START
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1311 ;; specifies the actual line for insert, thus
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1312 ;; requiring less hair in the realization algs.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1313 ;; For Emacs spirit, we use `i' for "insert".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1314 `(,(1+ start) i
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1315 ,(funcall sub (point) (progn (forward-line act)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1316 (point)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1317 (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
1318 cmd context)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1319 acc))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1320 (goto-char (1+ e))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1321 (setcar (cdr rev) (cons :insn acc)))))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1322 ;; rv
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1323 `((headers ,desc ,@headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1324 (revisions ,@revs)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1325
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1326 (provide 'vc-rcs)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1327
56953
2cc3f5b16438 Doc fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56318
diff changeset
1328 ;; arch-tag: 759b4916-5b0d-431d-b647-b185b8c652cf
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1329 ;;; vc-rcs.el ends here