annotate lisp/vc-rcs.el @ 107672:abfd9eb36f84

Note in documentation that nXML is now the default XML mode. * text.texi (HTML Mode): Note that nXML is now the default XML mode. * emacs.texi: Update node description.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 25 Mar 2010 16:32:39 -0400
parents 1d1d5d9bd884
children 1918e70c8b37 376148b31b5e
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,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106671
diff changeset
4 ;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
100183
0cc235691369 (vc-rcs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100171
diff changeset
5 ;; Free Software Foundation, Inc.
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; Author: FSF (see vc.el for full credits)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94627
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94627
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94627
diff changeset
15 ;; (at your option) any later version.
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94627
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36712
diff changeset
25 ;;; Commentary:
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36712
diff changeset
26
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36712
diff changeset
27 ;; See vc.el
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
105590
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
29 ;; Some features will not work with old RCS versions. Where
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
30 ;; appropriate, VC finds out which version you have, and allows or
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
31 ;; disallows those features (stealing locks, for example, works only
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
32 ;; from 5.6.2 onwards).
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
33 ;; Even initial checkins will fail if your RCS version is so old that ci
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
34 ;; doesn't understand -t-; this has been known to happen to people running
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
35 ;; NExTSTEP 3.0.
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
36 ;;
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
37 ;; You can support the RCS -x option by customizing vc-rcs-master-templates.
7e0a5f5d7775 * vc.el: Move comments about RCS and SCCS ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105170
diff changeset
38
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 ;;; Code:
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
41 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
42 ;;; Customization options
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
43 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
44
31840
a05558c54226 (toplevel): Require `vc' when compiling.
Gerd Moellmann <gerd@gnu.org>
parents: 31835
diff changeset
45 (eval-when-compile
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
46 (require 'cl)
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
47 (require 'vc))
31840
a05558c54226 (toplevel): Require `vc' when compiling.
Gerd Moellmann <gerd@gnu.org>
parents: 31835
diff changeset
48
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 (defcustom vc-rcs-release nil
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 98184
diff changeset
50 "The release number of your RCS installation, as a string.
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 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
52 :type '(choice (const :tag "Auto" nil)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 (string :tag "Specified")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (const :tag "Unknown" unknown))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 (defcustom vc-rcs-register-switches nil
100204
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
58 "Switches for registering a file in RCS.
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
59 A string or list of strings passed to the checkin program by
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
60 \\[vc-register]. If nil, use the value of `vc-register-switches'.
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
61 If t, use no switches."
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
62 :type '(choice (const :tag "Unspecified" nil)
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
63 (const :tag "None" t)
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (string :tag "Argument String")
100204
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
65 (repeat :tag "Argument List" :value ("") string))
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
66 :version "21.1"
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
69 (defcustom vc-rcs-diff-switches nil
100183
0cc235691369 (vc-rcs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100171
diff changeset
70 "String or list of strings specifying switches for RCS diff under VC.
0cc235691369 (vc-rcs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100171
diff changeset
71 If nil, use the value of `vc-diff-switches'. If t, use no switches."
0cc235691369 (vc-rcs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100171
diff changeset
72 :type '(choice (const :tag "Unspecified" nil)
0cc235691369 (vc-rcs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100171
diff changeset
73 (const :tag "None" t)
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
74 (string :tag "Argument String")
100183
0cc235691369 (vc-rcs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100171
diff changeset
75 (repeat :tag "Argument List" :value ("") string))
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
76 :version "21.1"
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
77 :group 'vc)
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
78
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 (defcustom vc-rcs-header (or (cdr (assoc 'RCS vc-header-alist)) '("\$Id\$"))
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 98184
diff changeset
80 "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
81 :type '(repeat string)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
82 :version "21.1"
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (defcustom vc-rcsdiff-knows-brief nil
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 98184
diff changeset
86 "Indicates whether rcsdiff understands the --brief option.
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 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
88 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
89 :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
90 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 ;;;###autoload
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 (defcustom vc-rcs-master-templates
105939
a0f778f4a995 * term/x-win.el (x-gtk-stock-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105590
diff changeset
94 (purecopy '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s"))
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 98184
diff changeset
95 "Where to look for RCS master files.
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 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
97 :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
98 '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s"))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (repeat :tag "User-specified"
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (choice string
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 function)))
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
102 :version "21.1"
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 :group 'vc)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
105
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
106 ;;; 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
107
94563
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
108 (defun vc-rcs-revision-granularity () 'file)
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
109
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
110 (defun vc-rcs-checkout-model (files)
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
111 "RCS-specific version of `vc-checkout-model'."
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
112 (let ((file (if (consp files) (car files) files))
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
113 result)
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
114 (when vc-consult-headers
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
115 (vc-file-setprop file 'vc-checkout-model nil)
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
116 (vc-rcs-consult-headers file)
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
117 (setq result (vc-file-getprop file 'vc-checkout-model)))
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
118 (or result
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
119 (progn (vc-rcs-fetch-master-state file)
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
120 (vc-file-getprop file 'vc-checkout-model)))))
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
121
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
122 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
123 ;;; State-querying functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
124 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
125
94481
ad6c174910db Make `checkout-model' apply to filesets.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94003
diff changeset
126 ;; The autoload cookie below places vc-rcs-registered directly into
ad6c174910db Make `checkout-model' apply to filesets.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94003
diff changeset
127 ;; loaddefs.el, so that vc-rcs.el does not need to be loaded for
ad6c174910db Make `checkout-model' apply to filesets.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94003
diff changeset
128 ;; every file that is visited.
ad6c174910db Make `checkout-model' apply to filesets.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94003
diff changeset
129 ;;;###autoload
ad6c174910db Make `checkout-model' apply to filesets.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94003
diff changeset
130 (progn
ad6c174910db Make `checkout-model' apply to filesets.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94003
diff changeset
131 (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
132
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (defun vc-rcs-state (file)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 "Implementation of `vc-state' for RCS."
94537
e158200330c2 (vc-rcs-state): Fix typos.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94522
diff changeset
135 (if (not (vc-rcs-registered file))
94521
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
136 'unregistered
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
137 (or (boundp 'vc-rcs-headers-result)
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
138 (and vc-consult-headers
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
139 (vc-rcs-consult-headers file)))
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
140 (let ((state
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
141 ;; vc-working-revision might not be known; in that case the
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
142 ;; property is nil. vc-rcs-fetch-master-state knows how to
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
143 ;; handle that.
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
144 (vc-rcs-fetch-master-state file
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
145 (vc-file-getprop file
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
146 'vc-working-revision))))
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
147 (if (not (eq state 'up-to-date))
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
148 state
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
149 (if (vc-workfile-unchanged-p file)
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
150 'up-to-date
94563
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
151 (if (eq (vc-rcs-checkout-model (list file)) 'locking)
94521
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
152 'unlocked-changes
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
153 'edited))))))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 (defun vc-rcs-state-heuristic (file)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 "State heuristic for RCS."
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157 (let (vc-rcs-headers-result)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 (if (and vc-consult-headers
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
159 (setq vc-rcs-headers-result
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 (vc-rcs-consult-headers file))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 (eq vc-rcs-headers-result 'rev-and-lock))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 (let ((state (vc-file-getprop file 'vc-state)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 ;; 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
164 ;; 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
165 ;; the file or not.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 (if (and (eq state 'up-to-date)
95825
85ee8c71ce8c (vc-rcs-state-heuristic): Don't assume the file exists.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 95038
diff changeset
167 (not (vc-mistrust-permissions file))
85ee8c71ce8c (vc-rcs-state-heuristic): Don't assume the file exists.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 95038
diff changeset
168 (file-exists-p file))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 ((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
171 (vc-file-setprop file 'vc-checkout-model 'implicit)
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
172 (setq state
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
173 (if (vc-rcs-workfile-is-newer file)
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
174 'edited
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
175 'up-to-date)))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 ((string-match ".r-..-..-." (nth 8 (file-attributes file)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 (vc-file-setprop file 'vc-checkout-model 'locking))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 state)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 (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
180 (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
181 (owner-name (nth 2 attributes))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 (permissions (nth 8 attributes)))
95825
85ee8c71ce8c (vc-rcs-state-heuristic): Don't assume the file exists.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 95038
diff changeset
183 (cond ((and permissions (string-match ".r-..-..-." permissions))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 (vc-file-setprop file 'vc-checkout-model 'locking)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 'up-to-date)
95825
85ee8c71ce8c (vc-rcs-state-heuristic): Don't assume the file exists.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 95038
diff changeset
186 ((and permissions (string-match ".rw..-..-." permissions))
94481
ad6c174910db Make `checkout-model' apply to filesets.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94003
diff changeset
187 (if (eq (vc-rcs-checkout-model file) 'locking)
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
188 (if (file-ownership-preserved-p file)
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
189 'edited
68332
a6ef676caa6d (vc-rcs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents: 64762
diff changeset
190 owner-name)
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
191 (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
192 'edited
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
193 'up-to-date)))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194 (t
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 ;; Strange permissions. Fall through to
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 ;; expensive state computation.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 (vc-rcs-state file))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (vc-rcs-state file)))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199
94003
2ecb2ea8d5b5 Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93867
diff changeset
200 (defun vc-rcs-dir-status (dir update-function)
94835
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
201 ;; FIXME: this function should be rewritten or `vc-expand-dirs'
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
202 ;; should be changed to take a backend parameter. Using
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
203 ;; `vc-expand-dirs' is not TRTD because it returns files from
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
204 ;; multiple backends. It should also return 'unregistered files.
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
205
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
206 ;; Doing individual vc-state calls is painful but there
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
207 ;; is no better way in RCS-land.
93677
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
208 (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
209 (result nil))
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
210 (dolist (file flist)
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
211 (let ((state (vc-state file))
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
212 (frel (file-relative-name file)))
94835
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
213 (when (and (eq (vc-backend file) 'RCS)
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
214 (not (eq state 'up-to-date)))
0f7a18ff94d6 * vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94809
diff changeset
215 (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
216 (funcall update-function result)))
93677
112903000f93 * vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 92165
diff changeset
217
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
218 (defun vc-rcs-working-revision (file)
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
219 "RCS-specific version of `vc-working-revision'."
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
220 (or (and vc-consult-headers
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
221 (vc-rcs-consult-headers file)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
222 (vc-file-getprop file 'vc-working-revision))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
223 (progn
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
224 (vc-rcs-fetch-master-state file)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
225 (vc-file-getprop file 'vc-working-revision))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
226
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
227 (defun vc-rcs-latest-on-branch-p (file &optional version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
228 "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
229 When VERSION is given, perform check for that version."
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
230 (unless version (setq version (vc-working-revision file)))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
231 (with-temp-buffer
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
232 (string= version
104621
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
233 (if (vc-rcs-trunk-p version)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
234 (progn
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
235 ;; Compare VERSION to the head version number.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
236 (vc-insert-file (vc-name file) "^[0-9]")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
237 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
238 ;; If we are not on the trunk, we need to examine the
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
239 ;; whole current branch.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
240 (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
241 (vc-rcs-find-most-recent-rev (vc-branch-part version))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
242
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
243 (defun vc-rcs-workfile-unchanged-p (file)
56953
2cc3f5b16438 Doc fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56318
diff changeset
244 "RCS-specific implementation of `vc-workfile-unchanged-p'."
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
245 ;; Try to use rcsdiff --brief. If rcsdiff does not understand that,
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
246 ;; 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
247 (let* ((version (concat "-r" (vc-working-revision file)))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
248 (status (if (eq vc-rcsdiff-knows-brief 'no)
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
249 (vc-do-command "*vc*" 1 "rcsdiff" file version)
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
250 (vc-do-command "*vc*" 2 "rcsdiff" file "--brief" version))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
251 (if (eq status 2)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
252 (if (not vc-rcsdiff-knows-brief)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
253 (setq vc-rcsdiff-knows-brief 'no
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
254 status (vc-do-command "*vc*" 1 "rcsdiff" file version))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
255 (error "rcsdiff failed"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
256 (if (not vc-rcsdiff-knows-brief) (setq vc-rcsdiff-knows-brief 'yes)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
257 ;; The workfile is unchanged if rcsdiff found no differences.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
258 (zerop status)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
259
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 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
262 ;;; State-changing functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
263 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
264
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
265 (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
266 "Create a new RCS repository."
100204
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
267 ;; RCS is totally file-oriented, so all we have to do is make the directory.
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
268 (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
269
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 (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
271 "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
272 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
273 to provide an initial description for each FILES.
100204
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
274 Passes either `vc-rcs-register-switches' or `vc-register-switches'
30afce094fe2 (vc-rcs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents: 100183
diff changeset
275 to the RCS command.
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
276
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
277 Automatically retrieve a read-only version of the file with keywords
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
278 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
279 (let (subdir name)
106671
1b4df859a104 * vc-rcs.el (vc-rcs-register): Fix registering a specific version.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106472
diff changeset
280 ;; When REV is specified, we need to force using "-t-".
1b4df859a104 * vc-rcs.el (vc-rcs-register): Fix registering a specific version.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106472
diff changeset
281 (when rev (unless comment (setq comment "")))
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
282 (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
283 (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
284 (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
285 (file-name-directory file)))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
286 (not (directory-files (file-name-directory file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
287 nil ".*,v$" t))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
288 (yes-or-no-p "Create RCS subdirectory? ")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
289 (make-directory subdir))
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
290 (apply 'vc-do-command "*vc*" 0 "ci" file
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
291 ;; if available, use the secure registering option
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
292 (and (vc-rcs-release-p "5.6.4") "-i")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
293 (concat (if vc-keep-workfiles "-u" "-r") rev)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
294 (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
295 (vc-switches 'RCS 'register))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
296 ;; parse output to find master file name and workfile version
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
297 (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
298 (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
299 (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
300 (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
301 (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
302 (match-string 1))))
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
303 ;; 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
304 ;; 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
305 ;; (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
306 (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
307 (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
308 (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
309 name
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
310 (expand-file-name
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
311 name
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
312 (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
313 (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
314 (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
315 "^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
316 nil t)
6bb6b2500e35 (vc-rcs-register): Fix treatment of directories in multiple file case.
Glenn Morris <rgm@gnu.org>
parents: 91956
diff changeset
317 (match-string 1))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
318
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
319 (defun vc-rcs-responsible-p (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
320 "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
321 ;; TODO: check for all the patterns in vc-rcs-master-templates
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
322 (file-directory-p (expand-file-name "RCS" (file-name-directory file))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
323
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
324 (defun vc-rcs-receive-file (file rev)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
325 "Implementation of receive-file for RCS."
94563
a0bb8ca25a33 Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94537
diff changeset
326 (let ((checkout-model (vc-rcs-checkout-model (list file))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
327 (vc-rcs-register file rev "")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
328 (when (eq checkout-model 'implicit)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
329 (vc-rcs-set-non-strict-locking file))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
330 (vc-rcs-set-default-branch file (concat rev ".1"))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
331
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
332 (defun vc-rcs-unregister (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
333 "Unregister FILE from RCS.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
334 If this leaves the RCS subdirectory empty, ask the user
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
335 whether to remove it."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
336 (let* ((master (vc-name file))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
337 (dir (file-name-directory master))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
338 (backup-info (find-backup-file-name master)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
339 (if (not backup-info)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
340 (delete-file master)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
341 (rename-file master (car backup-info) 'ok-if-already-exists)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
342 (dolist (f (cdr backup-info)) (ignore-errors (delete-file f))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
343 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
344 ;; check whether RCS dir is empty, i.e. it does not
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
345 ;; contain any files except "." and ".."
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49092
diff changeset
346 (not (directory-files dir nil
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
347 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
348 (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
349 (delete-directory dir))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
350
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
351 (defun vc-rcs-checkin (files rev comment)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
352 "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
353 (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
354 ;; Now operate on the files
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
355 (dolist (file (vc-expand-dirs files))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
356 (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
357 (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
358 ;; 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
359 ;; 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
360 (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
361 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
362 (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
363 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
364 (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
365 (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
366 (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
367 (setq rev (vc-branch-part old-version)))
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
368 (apply 'vc-do-command "*vc*" 0 "ci" (vc-name 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
369 ;; 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
370 (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
371 (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
372 (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
373 switches)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
374 (vc-file-setprop file 'vc-working-revision nil)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
375
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
376 ;; 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
377 (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
378 (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
379 (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
380 "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
381 (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
382 "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
383 (setq new-version (match-string 1))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
384 (vc-file-setprop file 'vc-working-revision new-version))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
385
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
386 ;; 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
387 ;; 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
388 (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
389 ((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
390 (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
391 (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
392 (vc-rcs-set-default-branch file
104621
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
393 (if (vc-rcs-trunk-p new-version) nil
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
394 (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
395 ;; 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
396 ;; 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
397 (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
398 ;; 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
399 ;; It means that the lock was removed before.
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
400 (vc-do-command "*vc*" 1 "rcs" (vc-name 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
401 (concat "-u" old-version)))))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
402
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
403 (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
404 (apply 'vc-do-command
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
405 (or buffer "*vc*") 0 "co" (vc-name file)
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
406 "-q" ;; suppress diagnostic output
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
407 (concat "-p" rev)
50903
c03b80e1bacd (vc-rcs-register, vc-rcs-checkin, vc-rcs-checkout)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49597
diff changeset
408 (vc-switches 'RCS 'checkout)))
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
409
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
410 (defun vc-rcs-checkout (file &optional editable rev)
98184
eb56a710c41c * vc-rcs.el (vc-rcs-steal-lock, vc-rcs-checkout): Fix docstring typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 98086
diff changeset
411 "Retrieve a copy of a saved version of FILE. If FILE is a directory,
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
412 attempt the checkout for all registered files beneath it."
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
413 (if (file-directory-p file)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
414 (mapc 'vc-rcs-checkout (vc-expand-dirs (list file)))
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
415 (let ((file-buffer (get-file-buffer file))
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
416 switches)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
417 (message "Checking out %s..." file)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
418 (save-excursion
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
419 ;; Change buffers to get local value of vc-checkout-switches.
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
420 (if file-buffer (set-buffer file-buffer))
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
421 (setq switches (vc-switches 'RCS 'checkout))
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
422 ;; Save this buffer's default-directory
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
423 ;; and use save-excursion to make sure it is restored
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
424 ;; in the same buffer it was saved in.
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
425 (let ((default-directory default-directory))
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
426 (save-excursion
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
427 ;; Adjust the default-directory so that the check-out creates
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
428 ;; the file in the right place.
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
429 (setq default-directory (file-name-directory file))
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
430 (let (new-version)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
431 ;; if we should go to the head of the trunk,
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
432 ;; clear the default branch first
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
433 (and rev (string= rev "")
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
434 (vc-rcs-set-default-branch file nil))
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
435 ;; now do the checkout
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
436 (apply 'vc-do-command
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
437 "*vc*" 0 "co" (vc-name file)
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
438 ;; If locking is not strict, force to overwrite
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
439 ;; the writable workfile.
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
440 (if (eq (vc-rcs-checkout-model (list file)) 'implicit) "-f")
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
441 (if editable "-l")
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
442 (if (stringp rev)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
443 ;; a literal revision was specified
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
444 (concat "-r" rev)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
445 (let ((workrev (vc-working-revision file)))
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
446 (if workrev
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
447 (concat "-r"
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
448 (if (not rev)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
449 ;; no revision specified:
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
450 ;; use current workfile version
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
451 workrev
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
452 ;; REV is t ...
104621
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
453 (if (not (vc-rcs-trunk-p workrev))
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
454 ;; ... go to head of current branch
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
455 (vc-branch-part workrev)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
456 ;; ... go to head of trunk
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
457 (vc-rcs-set-default-branch file
48966
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
458 nil)
a327c58de610 (vc-rcs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents: 48282
diff changeset
459 ""))))))
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
460 switches)
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
461 ;; determine the new workfile version
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
462 (with-current-buffer "*vc*"
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
463 (setq new-version
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
464 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1)))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
465 (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
466 ;; if necessary, adjust the default branch
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
467 (and rev (not (string= rev ""))
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
468 (vc-rcs-set-default-branch
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
469 file
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
470 (if (vc-rcs-latest-on-branch-p file new-version)
104621
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
471 (if (vc-rcs-trunk-p new-version) nil
47797
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
472 (vc-branch-part new-version))
d0555af982c8 (vc-rcs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47757
diff changeset
473 new-version)))))
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
474 (message "Checking out %s...done" file))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
475
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
476 (defun vc-rcs-rollback (files)
95038
a25916c502ba (vc-rcs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents: 95020
diff changeset
477 "Roll back, undoing the most recent checkins of FILES. Directories are
98184
eb56a710c41c * vc-rcs.el (vc-rcs-steal-lock, vc-rcs-checkout): Fix docstring typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 98086
diff changeset
478 expanded to all registered subfiles in them."
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 (if (not files)
105170
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105010
diff changeset
480 (error "RCS backend doesn't support directory-level rollback"))
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
481 (dolist (file (vc-expand-dirs files))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
482 (let* ((discard (vc-working-revision file))
104621
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
483 (previous (if (vc-rcs-trunk-p discard) "" (vc-branch-part discard)))
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
484 (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
485 (done nil))
91955
e3aedad81f5f Kill eol whitespace; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 87649
diff changeset
486 (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
487 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
488 (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
489 (message "Removing revision %s from %s." discard file)
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
490 (vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-o" discard))
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
491 ;; 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
492 ;; 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
493 ;; 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
494 ;; 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
495 (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
496 (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
497 (progn
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
498 (vc-do-command "*vc*" 0 "co" (vc-name file) "-f"
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
499 (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
500 (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
501 (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
502 (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
503 (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
504 (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
505 (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
506 ;; 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
507 ;; 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
508 ;; 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
509 (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
510 ;; 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
511 (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
512
39001
d13c2139752b (vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents: 38436
diff changeset
513 (defun vc-rcs-revert (file &optional contents-done)
95038
a25916c502ba (vc-rcs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents: 95020
diff changeset
514 "Revert FILE to the version it was based on. If FILE is a directory,
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
515 revert all registered files beneath it."
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
516 (if (file-directory-p file)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
517 (mapc 'vc-rcs-revert (vc-expand-dirs (list file)))
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
518 (vc-do-command "*vc*" 0 "co" (vc-name file) "-f"
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
519 (concat (if (eq (vc-state file) 'edited) "-u" "-r")
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
520 (vc-working-revision file)))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
521
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
522 (defun vc-rcs-merge (file first-version &optional second-version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
523 "Merge changes into current working copy of FILE.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
524 The changes are between FIRST-VERSION and SECOND-VERSION."
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
525 (vc-do-command "*vc*" 1 "rcsmerge" (vc-name file)
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
526 "-kk" ; ignore keyword conflicts
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
527 (concat "-r" first-version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
528 (if second-version (concat "-r" second-version))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
529
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
530 (defun vc-rcs-steal-lock (file &optional rev)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
531 "Steal the lock on the current workfile for FILE and revision REV.
98184
eb56a710c41c * vc-rcs.el (vc-rcs-steal-lock, vc-rcs-checkout): Fix docstring typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 98086
diff changeset
532 If FILE is a directory, steal the lock on all registered files beneath it.
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
533 Needs RCS 5.6.2 or later for -M."
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
534 (if (file-directory-p file)
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
535 (mapc 'vc-rcs-steal-lock (vc-expand-dirs (list file)))
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
536 (vc-do-command "*vc*" 0 "rcs" (vc-name file) "-M" (concat "-u" rev))
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
537 ;; Do a real checkout after stealing the lock, so that we see
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
538 ;; expanded headers.
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
539 (vc-do-command "*vc*" 0 "co" (vc-name file) "-f" (concat "-l" rev))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
540
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
541 (defun vc-rcs-modify-change-comment (files rev comment)
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
542 "Modify the change comments change on FILES on a specified REV. If FILE is a
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
543 directory the operation is applied to all registered files beneath it."
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
544 (dolist (file (vc-expand-dirs files))
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
545 (vc-do-command "*vc*" 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
546 (concat "-m" rev ":" comment))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
547
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
548
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
549 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
550 ;;; History functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
551 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
552
104711
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
553 (defun vc-rcs-print-log-cleanup ()
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
554 (let ((inhibit-read-only t))
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
555 (goto-char (point-max))
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
556 (forward-line -1)
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
557 (while (looking-at "=*\n")
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
558 (delete-char (- (match-end 0) (match-beginning 0)))
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
559 (forward-line -1))
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
560 (goto-char (point-min))
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
561 (when (looking-at "[\b\t\n\v\f\r ]+")
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
562 (delete-char (- (match-end 0) (match-beginning 0))))))
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
563
106472
6e0f1038bc44 Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106060
diff changeset
564 (defun vc-rcs-print-log (files buffer &optional shortlog start-revision-ignored limit)
94809
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
565 "Get change log associated with FILE. If FILE is a
76b523d99056 Teach the RCS back end to do directories.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94806
diff changeset
566 directory the operation is applied to all registered files beneath it."
104711
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
567 (vc-do-command (or buffer "*vc*") 0 "rlog" (mapcar 'vc-name (vc-expand-dirs files)))
adeed914a5fb * vc.el (vc-print-log-internal): Move RCS/CVS specific code ...
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104621
diff changeset
568 (with-current-buffer (or buffer "*vc*")
106060
2f9ecf376c7a * vc.el (vc-log-show-limit): Default to 2000.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106054
diff changeset
569 (vc-rcs-print-log-cleanup))
2f9ecf376c7a * vc.el (vc-log-show-limit): Default to 2000.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 106054
diff changeset
570 (when limit 'limit-unsupported))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
571
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
572 (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
573 "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
574 (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
575 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
576 "rcsdiff" (vc-expand-dirs files)
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
577 (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
578 (and oldvers (concat "-r" oldvers))
35822
cd59c63d4aac (vc-rcs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents: 35178
diff changeset
579 (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
580 (vc-switches 'RCS 'diff))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
581
94806
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
582 (defun vc-rcs-comment-history (file)
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
583 "Return a string with all log entries stored in BACKEND for FILE."
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
584 (with-current-buffer "*vc*"
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
585 ;; Has to be written this way, this function is used by the CVS backend too
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
586 (vc-call-backend (vc-backend file) 'print-log (list file))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
587 ;; Remove cruft
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
588 (let ((separator (concat "^-+\nrevision [0-9.]+\ndate: .*\n"
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
589 "\\(branches: .*;\n\\)?"
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
590 "\\(\\*\\*\\* empty log message \\*\\*\\*\n\\)?")))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
591 (goto-char (point-max)) (forward-line -1)
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
592 (while (looking-at "=*\n")
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
593 (delete-char (- (match-end 0) (match-beginning 0)))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
594 (forward-line -1))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
595 (goto-char (point-min))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
596 (if (looking-at "[\b\t\n\v\f\r ]+")
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
597 (delete-char (- (match-end 0) (match-beginning 0))))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
598 (goto-char (point-min))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
599 (re-search-forward separator nil t)
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
600 (delete-region (point-min) (point))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
601 (while (re-search-forward separator nil t)
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
602 (delete-region (match-beginning 0) (match-end 0))))
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
603 ;; Return the de-crufted comment list
eedf64b515f0 Remove wash-log from the VC backend API.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94678
diff changeset
604 (buffer-string)))
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
605
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
606 (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
607 "Annotate FILE, inserting the results in BUFFER.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
608 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
609 (vc-setup-buffer buffer)
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
610 ;; 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
611 ;; 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
612 ;; commands necessary to go from the chronologically-following
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
613 ;; 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
614 ;; 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
615 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
616 ;; 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
617 ;; 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
618 ;; 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
619 ;; 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
620 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
621 ;; 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
622 ;; 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
623 ;; 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
624 ;; 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
625 ;; 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
626 ;; 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
627 ;; or on a branch).
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
628 (let* ((tree (with-temp-buffer
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
629 (insert-file-contents (vc-rcs-registered file))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
630 (vc-rcs-parse)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
631 (revisions (cdr (assq 'revisions tree)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
632 ;; 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
633 (cur (cdr (assq 'head (cdr (assq 'headers tree)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
634 ;; Alist from the parse tree for N.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
635 (meta (cdr (assoc cur revisions)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
636 ;; Point and temporary string, respectively.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
637 p s
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
638 ;; "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
639 ;; 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
640 ;; 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
641 ;; (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
642 ;; 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
643 ;; revision to the desired revision to display.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
644 nbls
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
645 ;; "Path-accumulate-predicate plus revision/date/author".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
646 ;; Until set, forward-chronological edits are not accumulated.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
647 ;; 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
648 ;; 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
649 ;; processing of forward-chronological instructions for N.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
650 ;; See internal func `r/d/a'.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
651 prda
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
652 ;; List of forward-chronological instructions, each of the
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
653 ;; 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
654 ;; 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
655 ;; the number of characters to be deleted.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
656 path
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
657 ;; 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
658 pre)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
659 (unless revision
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
660 (setq revision cur))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
661 (unless (assoc revision revisions)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
662 (error "No such revision: %s" revision))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
663 ;; 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
664 (let ((par revision)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
665 bpt kids)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
666 (while (setq bpt (vc-branch-part par)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
667 par (vc-branch-part bpt))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
668 (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
669 ;; 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
670 (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
671 (setq kids (cdr kids)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
672 (push (cons par (car kids)) nbls)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
673 ;; Start with the full text.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
674 (set-buffer buffer)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
675 (insert (cdr (assq 'text meta)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
676 ;; 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
677 ;; accumulating forward-chronological edits after some point, for
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
678 ;; later.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
679 (flet ((r/d/a () (vector pre
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
680 (cdr (assq 'date meta))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
681 (cdr (assq 'author meta)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
682 (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
683 (not (string= "" cur)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
684 (setq
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
685 ;; 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
686 ;; 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
687 ;; the appropriate branchpoint for it. Do this before
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
688 ;; 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
689 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
690 (r/d/a))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
691 meta (cdr (assoc cur revisions)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
692 ;; 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
693 ;; *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
694 ;; 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
695 ;; 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
696 ;; 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
697 ;; 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
698 ;; 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
699 ;; 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
700 ;; 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
701 (dolist (insn (cdr (assq :insn meta)))
104837
6c2939592100 (vc-rcs-annotate-command): Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104711
diff changeset
702 (goto-char (point-min))
6c2939592100 (vc-rcs-annotate-command): Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104711
diff changeset
703 (forward-line (1- (pop insn)))
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
704 (setq p (point))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
705 (case (pop insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
706 (k (setq s (buffer-substring-no-properties
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
707 p (progn (forward-line (car insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
708 (point))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
709 (when prda
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
710 (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
711 (delete-region p (point)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
712 (i (setq s (car insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
713 (when prda
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
714 (push `(,p . ,(length s)) path))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
715 (insert s)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
716 ;; 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
717 ;; 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
718 ;; 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
719 (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
720 ;; 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
721 (dolist (insn path)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
722 (goto-char (pop insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
723 (if (stringp insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
724 (insert insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
725 (delete-char insn)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
726 ;; 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
727 ;; 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
728 ;; `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
729 (while nbls
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
730 (setq pre (cdr (pop nbls)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
731 (while (progn
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
732 (setq meta (cdr (assoc pre revisions))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
733 prda nil)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
734 (dolist (insn (cdr (assq :insn meta)))
104837
6c2939592100 (vc-rcs-annotate-command): Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104711
diff changeset
735 (goto-char (point-min))
6c2939592100 (vc-rcs-annotate-command): Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104711
diff changeset
736 (forward-line (1- (pop insn)))
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
737 (case (pop insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
738 (k (delete-region
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
739 (point) (progn (forward-line (car insn))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
740 (point))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
741 (i (insert (propertize
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
742 (car insn)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
743 :vc-rcs-r/d/a
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
744 (or prda (setq prda (r/d/a))))))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
745 (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
746 (setq pre (cdr (assq 'next meta)))))))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
747 ;; 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
748 ;; 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
749 ;; 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
750 ;; 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
751 ;; 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
752 (let ((ht (make-hash-table :test 'eq))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
753 (me (user-login-name))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
754 (maxw 0)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
755 (all-me t)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
756 rda w a)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
757 (goto-char (point-max))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
758 (while (not (bobp))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
759 (forward-line -1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
760 (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
761 (unless (gethash rda ht)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
762 (setq a (aref rda 2)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
763 all-me (and all-me (string= a me)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
764 (puthash rda (setq w (+ (length (aref rda 0))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
765 (length a)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
766 ht)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
767 (setq maxw (max w maxw))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
768 (let ((padding (make-string maxw 32)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
769 (flet ((pad (w) (substring-no-properties padding w))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
770 (render (rda &rest ls)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
771 (propertize
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
772 (apply 'concat
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
773 (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
774 " "
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
775 (aref rda 0)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
776 ls)
76694
f35ed3fecce9 (vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 75347
diff changeset
777 :vc-annotate-prefix t
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
778 :vc-rcs-r/d/a rda)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
779 (maphash
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
780 (if all-me
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
781 (lambda (rda w)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
782 (puthash rda (render rda (pad w) ": ") ht))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
783 (lambda (rda w)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
784 (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
785 ht)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
786 (while (not (eobp))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
787 (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
788 (forward-line 1))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
789
96213
09da7727f35f * vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95825
diff changeset
790 (declare-function vc-annotate-convert-time "vc-annotate" (time))
09da7727f35f * vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 95825
diff changeset
791
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
792 (defun vc-rcs-annotate-current-time ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
793 "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
794 encoded as fractional days."
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
795 (vc-annotate-convert-time
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
796 (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
797
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
798 (defun vc-rcs-annotate-time ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
799 "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
800 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
801 (unless (eobp)
76694
f35ed3fecce9 (vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 75347
diff changeset
802 (prog1 (vc-annotate-convert-time
f35ed3fecce9 (vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 75347
diff changeset
803 (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
804 (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
805
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
806 (defun vc-rcs-annotate-extract-revision-at-line ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
807 (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
808
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
809
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
810 ;;;
95020
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
811 ;;; Tag system
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
812 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
813
95020
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
814 (defun vc-rcs-create-tag (backend dir name branchp)
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
815 (when branchp
95038
a25916c502ba (vc-rcs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents: 95020
diff changeset
816 (error "RCS backend %s does not support module branches" backend))
95020
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
817 (let ((result (vc-tag-precondition dir)))
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
818 (if (stringp result)
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
819 (error "File %s is not up-to-date" result)
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
820 (vc-file-tree-walk
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
821 dir
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
822 (lambda (f)
4da572dc4992 Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94847
diff changeset
823 (vc-do-command "*vc*" 0 "rcs" (vc-name f) (concat "-n" name ":")))))))
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
824
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
825
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
826 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
827 ;;; Miscellaneous
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
828 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
829
104621
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
830 (defun vc-rcs-trunk-p (rev)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
831 "Return t if REV is a revision on the trunk."
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
832 (not (eq nil (string-match "\\`[0-9]+\\.[0-9]+\\'" rev))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
833
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
834 (defun vc-rcs-minor-part (rev)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
835 "Return the minor revision number of a revision number REV."
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
836 (string-match "[0-9]+\\'" rev)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
837 (substring rev (match-beginning 0) (match-end 0)))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
838
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
839 (defun vc-rcs-previous-revision (file rev)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
840 "Return the revision number immediately preceding REV for FILE,
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
841 or nil if there is no previous revision. This default
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
842 implementation works for MAJOR.MINOR-style revision numbers as
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
843 used by RCS and CVS."
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
844 (let ((branch (vc-branch-part rev))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
845 (minor-num (string-to-number (vc-rcs-minor-part rev))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
846 (when branch
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
847 (if (> minor-num 1)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
848 ;; revision does probably not start a branch or release
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
849 (concat branch "." (number-to-string (1- minor-num)))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
850 (if (vc-rcs-trunk-p rev)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
851 ;; we are at the beginning of the trunk --
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
852 ;; don't know anything to return here
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
853 nil
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
854 ;; we are at the beginning of a branch --
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
855 ;; return revision of starting point
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
856 (vc-branch-part branch))))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
857
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
858 (defun vc-rcs-next-revision (file rev)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
859 "Return the revision number immediately following REV for FILE,
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
860 or nil if there is no next revision. This default implementation
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
861 works for MAJOR.MINOR-style revision numbers as used by RCS
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
862 and CVS."
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
863 (when (not (string= rev (vc-working-revision file)))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
864 (let ((branch (vc-branch-part rev))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
865 (minor-num (string-to-number (vc-rcs-minor-part rev))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
866 (concat branch "." (number-to-string (1+ minor-num))))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
867
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
868 (defun vc-rcs-update-changelog (files)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
869 "Default implementation of update-changelog.
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
870 Uses `rcs2log' which only works for RCS and CVS."
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
871 ;; FIXME: We (c|sh)ould add support for cvs2cl
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
872 (let ((odefault default-directory)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
873 (changelog (find-change-log))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
874 ;; Presumably not portable to non-Unixy systems, along with rcs2log:
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
875 (tempfile (make-temp-file
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
876 (expand-file-name "vc"
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
877 (or small-temporary-file-directory
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
878 temporary-file-directory))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
879 (login-name (or user-login-name
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
880 (format "uid%d" (number-to-string (user-uid)))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
881 (full-name (or add-log-full-name
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
882 (user-full-name)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
883 (user-login-name)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
884 (format "uid%d" (number-to-string (user-uid)))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
885 (mailing-address (or add-log-mailing-address
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
886 user-mail-address)))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
887 (find-file-other-window changelog)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
888 (barf-if-buffer-read-only)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
889 (vc-buffer-sync)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
890 (undo-boundary)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
891 (goto-char (point-min))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
892 (push-mark)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
893 (message "Computing change log entries...")
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
894 (message "Computing change log entries... %s"
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
895 (unwind-protect
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
896 (progn
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
897 (setq default-directory odefault)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
898 (if (eq 0 (apply 'call-process
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
899 (expand-file-name "rcs2log"
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
900 exec-directory)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
901 nil (list t tempfile) nil
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
902 "-c" changelog
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
903 "-u" (concat login-name
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
904 "\t" full-name
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
905 "\t" mailing-address)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
906 (mapcar
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
907 (lambda (f)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
908 (file-relative-name
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
909 (expand-file-name f odefault)))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
910 files)))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
911 "done"
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
912 (pop-to-buffer (get-buffer-create "*vc*"))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
913 (erase-buffer)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
914 (insert-file-contents tempfile)
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
915 "failed"))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
916 (setq default-directory (file-name-directory changelog))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
917 (delete-file tempfile)))))
f4a041a8c69d * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103937
diff changeset
918
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
919 (defun vc-rcs-check-headers ()
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
920 "Check if the current file has any headers in it."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
921 (save-excursion
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
922 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
923 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
924 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
925
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
926 (defun vc-rcs-clear-headers ()
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
927 "Implementation of vc-clear-headers for RCS."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
928 (let ((case-fold-search nil))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
929 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
930 (while (re-search-forward
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
931 (concat "\\$\\(Author\\|Date\\|Header\\|Id\\|Locker\\|Name\\|"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
932 "RCSfile\\|Revision\\|Source\\|State\\): [^$\n]+\\$")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
933 nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
934 (replace-match "$\\1$"))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
935
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
936 (defun vc-rcs-rename-file (old new)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
937 ;; Just move the master file (using vc-rcs-master-templates).
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
938 (vc-rename-master (vc-name old) new vc-rcs-master-templates))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
939
103553
af4ee0cb7fb7 * vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100908
diff changeset
940 (defun vc-rcs-find-file-hook ()
af4ee0cb7fb7 * vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100908
diff changeset
941 ;; If the file is locked by some other user, make
af4ee0cb7fb7 * vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100908
diff changeset
942 ;; the buffer read-only. Like this, even root
af4ee0cb7fb7 * vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100908
diff changeset
943 ;; cannot modify a file that someone else has locked.
103937
b0f266cccf0b * vc-rcs.el (vc-rcs-find-file-hook):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103596
diff changeset
944 (and (stringp (vc-state buffer-file-name 'RCS))
b0f266cccf0b * vc-rcs.el (vc-rcs-find-file-hook):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 103596
diff changeset
945 (setq buffer-read-only t)))
103553
af4ee0cb7fb7 * vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100908
diff changeset
946
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
947
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
948 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
949 ;;; Internal functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
950 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 32096
diff changeset
951
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
952 (defun vc-rcs-workfile-is-newer (file)
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
953 "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
954 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
955 to its master version."
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
956 (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
957 (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
958 (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
959 (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
960 (> (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
961
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
962 (defun vc-rcs-find-most-recent-rev (branch)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
963 "Find most recent revision on BRANCH."
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 (let ((latest-rev -1) value)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
966 (while (re-search-forward (concat "^\\(" (regexp-quote branch)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
967 "\\.\\([0-9]+\\)\\)\ndate[ \t]+[0-9.]+;")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
968 nil t)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
969 (let ((rev (string-to-number (match-string 2))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
970 (when (< latest-rev rev)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
971 (setq latest-rev rev)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
972 (setq value (match-string 1)))))
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
973 (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
974 (vc-branch-part branch))))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
975
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
976 (defun vc-rcs-fetch-master-state (file &optional working-revision)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
977 "Compute the master file's idea of the state of FILE.
98184
eb56a710c41c * vc-rcs.el (vc-rcs-steal-lock, vc-rcs-checkout): Fix docstring typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 98086
diff changeset
978 If a WORKING-REVISION 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
979 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
980 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
981 `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
982 file."
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
983 (with-temp-buffer
46543
7fa004ccd462 (vc-rcs-fetch-master-state): Be more careful to check
André Spiegel <spiegel@gnu.org>
parents: 44004
diff changeset
984 (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
985 (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
986 (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
987 (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
988 (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
989 (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
990 (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
991 (unless working-revision
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
992 ;; 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
993 ;; 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
994 ;; 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
995 ;; revision number.
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
996 (cond
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
997 ;; no default branch
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
998 ((or (not default-branch) (string= "" default-branch))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
999 (setq working-revision
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
1000 (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
1001 (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
1002 ;; 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
1003 ((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
1004 default-branch)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
1005 (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
1006 ;; 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
1007 (t (vc-insert-file (vc-name file) "^desc")
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
1008 (setq working-revision
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
1009 (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
1010 (setq workfile-is-latest t)))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
1011 (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
1012 ;; Check strict locking
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1013 (goto-char (point-min))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1014 (vc-file-setprop file 'vc-checkout-model
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1015 (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
1016 'locking 'implicit))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1017 ;; Compute state of workfile version
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1018 (goto-char (point-min))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1019 (let ((locking-user
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1020 (vc-parse-buffer (concat "^locks[ \t\n]+[^;]*[ \t\n]+\\([^:]+\\):"
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
1021 (regexp-quote working-revision)
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1022 "[^0-9.]")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1023 1)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1024 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1025 ;; not locked
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1026 ((not locking-user)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1027 (if (or workfile-is-latest
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
1028 (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
1029 ;; 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
1030 'up-to-date
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1031 ;; workfile version is not latest on branch
94521
2a61c5f918a5 Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94481
diff changeset
1032 'needs-update))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1033 ;; locked by the calling user
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1034 ((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
1035 (string= locking-user (vc-user-login-name file)))
94627
9cc7bc51e055 (vc-rcs-fetch-master-state): Fix inf-loop.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94563
diff changeset
1036 ;; Don't call `vc-rcs-checkout-model' to avoid inf-looping.
9cc7bc51e055 (vc-rcs-fetch-master-state): Fix inf-loop.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94563
diff changeset
1037 (if (or (eq (vc-file-getprop file 'vc-checkout-model) 'locking)
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1038 workfile-is-latest
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
1039 (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
1040 'edited
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1041 ;; 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
1042 ;; 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
1043 ;; 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
1044 ;; to use `needs-merge' in this case.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1045 'needs-merge))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1046 ;; locked by somebody else
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1047 ((stringp locking-user)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1048 locking-user)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1049 (t
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1050 (error "Error getting state of RCS file")))))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1051
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1052 (defun vc-rcs-consult-headers (file)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1053 "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
1054
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1055 Returns: nil if no headers were found
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1056 'rev if a workfile revision was found
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1057 '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
1058 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1059 ((not (get-file-buffer file)) nil)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1060 ((let (status version locking-user)
105994
009383a57ce8 * x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105939
diff changeset
1061 (with-current-buffer (get-file-buffer file)
106054
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1062 (save-excursion
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1063 (goto-char (point-min))
105994
009383a57ce8 * x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105939
diff changeset
1064 (cond
106054
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1065 ;; search for $Id or $Header
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1066 ;; -------------------------
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1067 ;; The `\ 's below avoid an RCS 5.7 bug when checking in this file.
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1068 ((or (and (search-forward "$Id\ : " nil t)
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1069 (looking-at "[^ ]+ \\([0-9.]+\\) "))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1070 (and (progn (goto-char (point-min))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1071 (search-forward "$Header\ : " nil t))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1072 (looking-at "[^ ]+ \\([0-9.]+\\) ")))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1073 (goto-char (match-end 0))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1074 ;; if found, store the revision number ...
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1075 (setq version (match-string-no-properties 1))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1076 ;; ... and check for the locking state
105994
009383a57ce8 * x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105939
diff changeset
1077 (cond
106054
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1078 ((looking-at
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1079 (concat "[0-9]+[/-][01][0-9][/-][0-3][0-9] " ; date
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1080 "[0-2][0-9]:[0-5][0-9]+:[0-6][0-9]+\\([+-][0-9:]+\\)? " ; time
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1081 "[^ ]+ [^ ]+ ")) ; author & state
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1082 (goto-char (match-end 0)) ; [0-6] in regexp handles leap seconds
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1083 (cond
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1084 ;; unlocked revision
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1085 ((looking-at "\\$")
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1086 (setq locking-user 'none)
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1087 (setq status 'rev-and-lock))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1088 ;; revision is locked by some user
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1089 ((looking-at "\\([^ ]+\\) \\$")
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1090 (setq locking-user (match-string-no-properties 1))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1091 (setq status 'rev-and-lock))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1092 ;; everything else: false
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1093 (nil)))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1094 ;; unexpected information in
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1095 ;; keyword string --> quit
105994
009383a57ce8 * x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105939
diff changeset
1096 (nil)))
106054
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1097 ;; search for $Revision
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1098 ;; --------------------
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1099 ((re-search-forward (concat "\\$"
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1100 "Revision: \\([0-9.]+\\) \\$")
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1101 nil t)
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1102 ;; if found, store the revision number ...
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1103 (setq version (match-string-no-properties 1))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1104 ;; and see if there's any lock information
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1105 (goto-char (point-min))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1106 (if (re-search-forward (concat "\\$" "Locker:") nil t)
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1107 (cond ((looking-at " \\([^ ]+\\) \\$")
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1108 (setq locking-user (match-string-no-properties 1))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1109 (setq status 'rev-and-lock))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1110 ((looking-at " *\\$")
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1111 (setq locking-user 'none)
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1112 (setq status 'rev-and-lock))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1113 (t
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1114 (setq locking-user 'none)
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1115 (setq status 'rev-and-lock)))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1116 (setq status 'rev)))
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1117 ;; else: nothing found
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1118 ;; -------------------
a7d1facd7ddf (vc-rcs-consult-headers): Add missing save-excursion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106033
diff changeset
1119 (t nil))))
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 82482
diff changeset
1120 (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
1121 (and (eq status 'rev-and-lock)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1122 (vc-file-setprop file 'vc-state
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1123 (cond
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1124 ((eq locking-user 'none) 'up-to-date)
76694
f35ed3fecce9 (vc-rcs-annotate-command):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 75347
diff changeset
1125 ((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
1126 'edited)
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1127 (t locking-user)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1128 ;; 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
1129 ;; master file, because that would eliminate all the
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1130 ;; performance gain the headers brought us. We therefore
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1131 ;; 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
1132 ;; 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
1133 ;; 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
1134 ;; 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
1135 ;; locking is not used.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1136 (not (vc-mistrust-permissions file))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1137 (vc-up-to-date-p file)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1138 (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
1139 (vc-file-setprop file 'vc-checkout-model 'locking)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1140 (vc-file-setprop file 'vc-checkout-model 'implicit)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1141 status))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1142
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1143 (defun vc-release-greater-or-equal (r1 r2)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1144 "Compare release numbers, represented as strings.
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1145 Release components are assumed cardinal numbers, not decimal fractions
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1146 \(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
1147 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
1148 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
1149 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
1150 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
1151 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
1152 (let (v1 v2 i1 i2)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1153 (catch 'done
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1154 (or (and (string-match "^\\.?\\([0-9]+\\)" r1)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1155 (setq i1 (match-end 0))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1156 (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
1157 (or (and (string-match "^\\.?\\([0-9]+\\)" r2)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1158 (setq i2 (match-end 0))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1159 (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
1160 (if (> v1 v2) (throw 'done t)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1161 (if (< v1 v2) (throw 'done nil)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1162 (throw 'done
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1163 (vc-release-greater-or-equal
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1164 (substring r1 i1)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1165 (substring r2 i2)))))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1166 (throw 'done t)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1167 (or (and (string-match "^\\.?\\([0-9]+\\)" r2)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1168 (throw 'done nil))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1169 (throw 'done t)))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1170
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1171 (defun vc-rcs-release-p (release)
31476
18bf0c070870 Doc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
1172 "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
1173 (let ((installation (vc-rcs-system-release)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1174 (if (and installation
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1175 (not (eq installation 'unknown)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1176 (vc-release-greater-or-equal installation release))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1177
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1178 (defun vc-rcs-system-release ()
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1179 "Return the RCS release installed on this system, as a string.
98184
eb56a710c41c * vc-rcs.el (vc-rcs-steal-lock, vc-rcs-checkout): Fix docstring typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 98086
diff changeset
1180 Return symbol `unknown' if the release cannot be deducted. The user can
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1181 override this using variable `vc-rcs-release'.
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1182
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1183 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
1184 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
1185 (or vc-rcs-release
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1186 (setq vc-rcs-release
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
1187 (or (and (zerop (vc-do-command "*vc*" nil "rcs" nil "-V"))
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1188 (with-current-buffer (get-buffer "*vc*")
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1189 (vc-parse-buffer "^RCS version \\([0-9.]+ *.*\\)" 1)))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1190 'unknown))))
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1191
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
1192 (defun vc-rcs-set-non-strict-locking (file)
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
1193 (vc-do-command "*vc*" 0 "rcs" file "-U")
31809
a2c432c6b343 (vc-rcs-workfile-is-newer): New function.
André Spiegel <spiegel@gnu.org>
parents: 31520
diff changeset
1194 (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
1195 (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
1196
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
1197 (defun vc-rcs-set-default-branch (file branch)
94847
5e64dca662f0 Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 94835
diff changeset
1198 (vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-b" branch))
32094
027fb880735d (vc-rcs-fetch-master-state): Parse and remember default branch
André Spiegel <spiegel@gnu.org>
parents: 32058
diff changeset
1199 (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
1200
58320
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1201 (defun vc-rcs-parse (&optional buffer)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1202 "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
1203 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
1204 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
1205 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
1206 strings and the keys are:
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1207
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1208 desc -- description
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1209 head -- latest revision
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1210 branch -- the branch the \"head revision\" lies on;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1211 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
1212 access -- ???
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1213 symbols -- sub-alist of (SYMBOL . REVISION) elements
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1214 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
1215 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
1216 comment -- may be absent; typically something like \"# \" or \"; \"
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1217 expand -- may be absent; ???
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1218
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1219 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
1220 with string values (unless otherwise specified) and keys:
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1221
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1222 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
1223 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
1224 author -- username
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1225 state -- typically \"Exp\" or \"Rel\"
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1226 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
1227 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
1228 on a branch: the chronologically-following revision, or \"\"
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1229 log -- change log entry
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1230 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
1231 other revisions have `:insn' instead
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1232 :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
1233 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
1234 go to line START\":
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1235 - `(START k COUNT)' -- kill COUNT lines
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1236 - `(START i TEXT)' -- insert TEXT (a string)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1237 The list is in descending order by START.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1238
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1239 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
1240 (setq buffer (get-buffer (or buffer (current-buffer))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1241 (set-buffer buffer)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1242 ;; 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
1243 ;; 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
1244 ;; 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
1245 ;; 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
1246 ;; 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
1247 ;; (c) are simply combined to form the "headers".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1248 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1249 ;; 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
1250 ;; "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
1251 ;; 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
1252 ;; 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
1253 ;; with it.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1254 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1255 ;; 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
1256 ;; 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
1257 ;; 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
1258 ;; 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
1259 ;; 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
1260 ;; 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
1261 ;; 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
1262 ;; initial step when translating to the value).
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1263 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1264 ;; 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
1265 (let ((desc nil) (headers nil) (revs nil)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1266 ;; ... 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
1267 ;; minimal-data-copying scan. Basically -- skirting around the
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1268 ;; 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
1269 ;; 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
1270 ;; determine the bounds of the printed representation, translate
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1271 ;; 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
1272 ;; collection vars. Finally, we return the parse tree
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1273 ;; 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
1274 ;;
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1275 ;; 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
1276 context
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1277 ;; A symbol, the current tag.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1278 tok
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1279 ;; 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
1280 ;; representation for the current tag.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1281 b e
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1282 ;; 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
1283 ;; 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
1284 ;; 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
1285 ;; 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
1286 ;; `(,e ,@@-holes ,b)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1287 ;; 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
1288 ;; 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
1289 ;; 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
1290 @-holes)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1291 (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
1292 (at (tag) (save-excursion (eq tag (read buffer))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1293 (to-eol () (buffer-substring-no-properties
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1294 (point) (progn (forward-line 1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1295 (1- (point)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1296 (to-semi () (setq b (point)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1297 e (progn (search-forward ";")
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1298 (1- (point)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1299 (to-one@ () (setq @-holes nil
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1300 b (progn (search-forward "@") (point))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1301 e (progn (while (and (search-forward "@")
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1302 (= ?@ (char-after))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1303 (progn
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1304 (push (point) @-holes)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1305 (forward-char 1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1306 (push (point) @-holes))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1307 (1- (point)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1308 (tok+val (set-b+e name &optional proc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1309 (unless (eq name (setq tok (read buffer)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1310 (error "Missing `%s' while parsing %s" name context))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1311 (sw)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1312 (funcall set-b+e)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1313 (cons tok (if proc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1314 (funcall proc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1315 (buffer-substring-no-properties b e))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1316 (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
1317 (gather () (let ((pairs `(,e ,@@-holes ,b))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1318 acc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1319 (while pairs
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1320 (push (buffer-substring-no-properties
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1321 (cadr pairs) (car pairs))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1322 acc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1323 (setq pairs (cddr pairs)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1324 (apply 'concat acc)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1325 (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
1326 (if later
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1327 (lambda () t)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1328 'gather))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1329 (save-excursion
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1330 (goto-char (point-min))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1331 ;; headers
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1332 (setq context 'headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1333 (flet ((hpush (name &optional proc)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1334 (push (k-semi name proc) headers)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1335 (hpush 'head)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1336 (when (at 'branch)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1337 (hpush 'branch))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1338 (hpush 'access)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1339 (hpush 'symbols
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1340 (lambda ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1341 (mapcar (lambda (together)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1342 (let ((two (split-string together ":")))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1343 (setcar two (intern (car two)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1344 (setcdr two (cadr two))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1345 two))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1346 (split-string
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1347 (buffer-substring-no-properties b e)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1348 (hpush 'locks))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1349 (push `(strict . ,(when (at 'strict)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1350 (search-forward ";")
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1351 t))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1352 headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1353 (when (at 'comment)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1354 (push (k-one@ 'comment) headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1355 (search-forward ";"))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1356 (when (at 'expand)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1357 (push (k-one@ 'expand) headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1358 (search-forward ";"))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1359 (setq headers (nreverse headers))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1360 ;; rev headers
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1361 (sw) (setq context 'rev-headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1362 (while (looking-at "[0-9]")
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1363 (push `(,(to-eol)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1364 ,(k-semi 'date
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1365 (lambda ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1366 (let ((ls (mapcar 'string-to-number
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1367 (split-string
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1368 (buffer-substring-no-properties
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1369 b e)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1370 "\\."))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1371 ;; Hack the year -- verified to be the
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1372 ;; same algorithm used in RCS 5.7.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1373 (when (< (car ls) 100)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1374 (setcar ls (+ 1900 (car ls))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1375 (apply 'encode-time (nreverse ls)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1376 ,@(mapcar 'k-semi '(author state))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1377 ,(k-semi 'branches
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1378 (lambda ()
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1379 (split-string
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1380 (buffer-substring-no-properties b e))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1381 ,(k-semi 'next))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1382 revs)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1383 (sw))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1384 (setq revs (nreverse revs))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1385 ;; desc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1386 (sw) (setq context 'desc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1387 desc (k-one@ 'desc))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1388 ;; rev bodies
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1389 (let (acc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1390 ;; 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
1391 ;; "Pairwise combination" occurs when we add body info.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1392 rev
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1393 ;; 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
1394 ;; text) that comprise the `text' printed representations
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1395 ;; (not including the "head" revision).
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1396 cmd start act
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1397 ;; Ascending (reversed) `@-holes' which the internal func
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1398 ;; `incg' pops to effect incremental gathering.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1399 asc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1400 ;; 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
1401 ;; `incg' or `buffer-substring-no-properties'. (This is
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1402 ;; 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
1403 ;; 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
1404 ;; latter in the absense of "@@".)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1405 sub)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1406 (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
1407 (while (and asc (< (car asc) e))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1408 (push (pop asc) @-holes))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1409 ;; Self-deprecate when work is done.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1410 ;; Folding many dimensions into one.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1411 ;; Thanks B.Mandelbrot, for complex sum.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1412 ;; O beauteous math! --the Unvexed Bum
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1413 (unless asc
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1414 (setq sub 'buffer-substring-no-properties))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1415 (gather))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1416 (while (and (sw)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1417 (not (eobp))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1418 (setq context (to-eol)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1419 rev (or (assoc context revs)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1420 (error "Rev `%s' has body but no head"
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1421 context))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1422 (push (k-one@ 'log) (cdr rev))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1423 ;; For rev body `text' tags, delay translation slightly...
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1424 (push (k-one@ 'text t) (cdr rev))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1425 ;; ... 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
1426 ;; 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
1427 ;; `text' printed representation by simple `gather'. For all
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1428 ;; 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
1429 ;; plus value, always scanning in-place.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1430 (if (string= context (cdr (assq 'head headers)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1431 (setcdr (cadr rev) (gather))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1432 (if @-holes
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1433 (setq asc (nreverse @-holes)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1434 sub 'incg)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1435 (setq sub 'buffer-substring-no-properties))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1436 (goto-char b)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1437 (setq acc nil)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1438 (while (< (point) e)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1439 (forward-char 1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1440 (setq cmd (char-before)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1441 start (read (current-buffer))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1442 act (read (current-buffer)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1443 (forward-char 1)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1444 (push (case cmd
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1445 (?d
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1446 ;; `d' means "delete lines".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1447 ;; For Emacs spirit, we use `k' for "kill".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1448 `(,start k ,act))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1449 (?a
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1450 ;; `a' means "append after this line" but
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1451 ;; internally we normalize it so that START
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1452 ;; specifies the actual line for insert, thus
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1453 ;; requiring less hair in the realization algs.
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1454 ;; For Emacs spirit, we use `i' for "insert".
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1455 `(,(1+ start) i
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1456 ,(funcall sub (point) (progn (forward-line act)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1457 (point)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1458 (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
1459 cmd context)))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1460 acc))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1461 (goto-char (1+ e))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1462 (setcar (cdr rev) (cons :insn acc)))))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1463 ;; rv
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1464 `((headers ,desc ,@headers)
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1465 (revisions ,@revs)))))
dee7926ded40 (vc-rcs-parse): New function.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56953
diff changeset
1466
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1467 (provide 'vc-rcs)
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1468
56953
2cc3f5b16438 Doc fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 56318
diff changeset
1469 ;; arch-tag: 759b4916-5b0d-431d-b647-b185b8c652cf
31383
860d7ac182e3 (vc-rcs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1470 ;;; vc-rcs.el ends here