annotate lispref/tindex.pl @ 31383:860d7ac182e3

(vc-rcs-show-log-entry): New function. (vc-rcs-checkin, vc-rcs-checkout): Don't set all properties. (vc-rcs-register): If there is no RCS subdir, ask the user whether to create one. (vc-rcs-state-heuristic): Use file-ownership-preserved-p. (vc-rcs-checkout): Remove the error-handling for missing-rcs. (vc-rcs-state-heuristic): Don't use file-writable-p. (vc-rcs-print-log): Insert in the current buffer. (vc-rcs-diff): Insert in the current buffer and remove unused arg CMP. (vc-rcs-workfile-unchanged-p): Use vc-do-command instead of vc-simple-command. (vc-rcs-fetch-master-state): Removed check for unlocked-changes to avoid doing a diff when opening a file. (vc-rcs-state): Added check for unlocked-changes. (vc-rcs-header): Escape Id. (vc-rcs-workfile-unchanged-p): Remove optional arg VERSION. (vc-rcs-state): Call vc-workfile-unchanged-p, not the RCS-specific version. (vc-rcs-state-heuristic): Use file-writable-p instead of comparing userids. (vc-rcs-fetch-master-state): Handle the case where rcs is missing. Simplify the logic by eliminating unreachable code. (vc-rcs-diff): Only pass `2' to vc-do-command if necessary and just do a recursive call if we need to retry. (vc-rcs-checkout): Handle the case where rcs is missing by making the buffer read-write if requested and re-signalling the error. (vc-rcs-find-most-recent-rev): New function. The code derives from the old vc-parse-buffer but uses the revision number rather than the date (much easier to compare robustly). (vc-rcs-fetch-master-state): Use `with-temp-buffer'. Adapt to the new vc-parse-buffer (and vc-rcs-find-most-recent-rev). Find the locking-user more directly. Check strict locking and set checkout-model appropriately. (vc-rcs-parse-locks): Remove. (vc-rcs-latest-on-branch-p): Use with-temp-buffer and adapt to the new vc-parse-buffer (and vc-rcs-find-most-recent-rev). (vc-rcs-system-release): Use with-current-buffer and vc-parse-buffer. (vc-rcs-register, vc-rcs-checkout): Use with-current-buffer. Merge in code from vc-rcs-hooks.el. Don't require 'vc anymore. (vc-rcs-responsible-p): Use expand-file-name instead of concat and file-directory-p instead of file-exists-p. (vc-rcs-exists): Remove. (vc-rcs-header): New var. Update Copyright. (vc-rcs-rename-file): New function. (vc-rcs-diff): Remove unused `backend' variable. (vc-rcs-clear-headers): New function; code moved here from vc-clear-headers in vc.el. (tail): Provide vc-rcs and remove vc-rcs-logentry-check. (vc-rcs-register): Parse command output to find master file name and workfile version. (vc-rcs-checkout): Removed call to vc-file-clear-masterprops. Require vc and vc-rcs-hooks. (vc-rcs-trunk-p, vc-rcs-branch-part): Move to vc-rcs-hooks. (vc-rcs-backend-release-p): Remove (use vc-rcs-release-p). (vc-release-greater-or-equal-p): Move from vc. (vc-rcs-trunk-p, vc-rcs-branch-p, vc-rcs-branch-part, vc-rcs-minor-part, vc-rcs-previous-version): Remove duplicates. (vc-rcs-checkout): Add a missing `new-version' argument in the call to vc-rcs-latest-on-branch-p. Hopefully that was the right one. (vc-rcs-steal-lock): Renamed from `vc-rcs-steal'. Updated everything to use `vc-checkout-model'. (vc-rcs-backend-release-p): function added. other stuff updated to reference this function instead of the old `vc-backend-release-p'. (vc-rcs-logentry-check): Function added. (vc-rcs-checkin, vc-rcs-previous-version) (vc-rcs-checkout): Name space cleaned up. No more revision number crunching function names that are not prefixed with vc-rcs. (vc-rcs-checkout-model): Function added. References to `vc-checkout-model' replaced. (vc-rcs-admin): Added the query-only option as required by the vc.el file. (vc-rcs-exists): Function added. (vc-*-checkout): Use with-temp-file instead of /bin/sh. Merged from mainline (vc-rcs-latest-on-branch-p): Moved to vc-rcs-hooks.el. (vc-rcs-latest-on-branch-p, vc-rcs-trunk-p) (vc-rcs-branch-p, vc-rcs-branch-part, vc-rcs-minor-part) (vc-rcs-previous-version): Functions added. (vc-rcs-diff): Function added. (vc-rcs-checkout) Bug (typo) found and fixed. (vc-rcs-register-switches) Variable `vc-rcs-register-switches' added. Require vc when compiling. (vc-rcs-print-log, vc-rcs-assign-name, vc-rcs-merge) (vc-rcs-check-headers, vc-rcs-steal, vc-rcs-uncheck, vc-rcs-revert) (vc-rcs-checkin): New functions (code from vc.el). (vc-rcs-previous-version, vc-rcs-system-release, vc-rcs-checkout): Doc fix. (vc-rcs-release): Deleted. (Duplicated vc-rcs-system-release). (vc-rcs-trunk-p, vc-rcs-branch-p, vc-rcs-branch-part) (vc-rcs-minor-part, vc-rcs-previous-version, vc-rcs-release) (vc-rcs-release-p, vc-rcs-admin, vc-rcs-checkout): New functions from vc.el. (vc-rcs-system-release): Renamed from vc-rcs-backend-release.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 04 Sep 2000 19:47:43 +0000
parents 8cd1df305566
children 23a1cea22d13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27188
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 #! /usr/bin/perl
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
3 # Copyright (C) 2000 Free Software Foundation, Inc.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4 #
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 # This file is part of GNU Emacs.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 #
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 # GNU Emacs is free software; you can redistribute it and/or modify
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 # it under the terms of the GNU General Public License as published by
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 # the Free Software Foundation; either version 2, or (at your option)
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 # any later version.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 #
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 # GNU Emacs is distributed in the hope that it will be useful,
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 # GNU General Public License for more details.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 #
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 # You should have received a copy of the GNU General Public License
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 # along with GNU Emacs; see the file COPYING. If not, write to the
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 # Boston, MA 02111-1307, USA.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 require 5;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23 use Getopt::Long;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 my $USAGE = <<ENDUSAGE;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26 Remove \@tindex lines from files that were already present in previous
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 versions.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 Usage: $0 [--old=EXT] FILE...
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 $0 --help
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 $0 --version
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 --help display this help and exit
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 --version print version and exit
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 --old=DIR find old files in DIR
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 The script performs two passes. In the first pass, Texinfo files from
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 DIR are scanned for \@tindex lines, and identifiers in them are
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 recorded. In a second pass, Texinfo files in the current directory
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 are scanned, and \@tindex lines for identifiers that were recorded in
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 the first pass are removed. Old file contents are saved in files
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 with extension ".orig". A list of modified files and removed \@tindex
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 identifiers is printed to stdout at the end.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 ENDUSAGE
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 sub fatal {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 print STDERR "$0: ", @_, ".\n";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 exit 1;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 my $help = 0;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 my $version = 0;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 my $old;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 my $rc = GetOptions ('help' => \$help, 'version' => \$version,
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 'old=s' => \$old);
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 if ($version) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 print "0.1\n";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 exit 0;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 } elsif (!$rc || !$old || @ARGV) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 print $USAGE;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 exit 1;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 } elsif ($help) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 print $USAGE;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 exit 0;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 # Fill the hash %tindex with associations VAR -> COUNT where
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 # the keys VAR are identifiers mentioned in @tindex lines in the older
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 # files to process and COUNT is the number of times they are seen in
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 # the files.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 my %tindex;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 my %removed;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 my @old_files = glob "$old/*.texi";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 my @new_files = glob "*.texi";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 fatal ("No Texinfo files found in `$old'") unless @old_files;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 fatal ("No Texinfo files found in current directory") unless @new_files;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 print "Scanning old files for \@tindex lines\n";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 foreach $file (@old_files) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 open (IN, "<$file") or fatal "Cannot open $file: $!";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 while (<IN>) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 ++$tindex{$1} if /^\s*\@tindex\s+(\S+)/;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 close IN;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 # Process current files and remove those @tindex lines which we
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 # know were already present in the files scanned above.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 print "Removing old \@tindex lines\n";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 foreach $file (@new_files) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 my $modified = 0;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 my $contents = "";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 open (IN, "< $file") or fatal "Cannot open $file.orig for reading: $!";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 while (<IN>) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 if (/^\s*\@tindex\s+(\S+)/ && $tindex{$1}) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 ++$removed{$1};
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 $modified = 1;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 } else {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 $contents = $contents . $_;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 close IN;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 if ($modified) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 print " $file\n";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 system ("cp $file $file.orig") == 0 or fatal "Cannot backup $file: $!";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 open (OUT, ">$file") or fatal "Cannot open $file for writing: $!";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 print OUT $contents;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 close OUT;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 # Print a list of identifiers removed.
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 print "Removed \@tindex commands for:\n";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 my $key;
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 foreach $key (keys %removed) {
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 print " $key\n";
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 }
8cd1df305566 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125