elimHeaderDiffs.prl
3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/local/bin/perl5 -w
#
# Copyright (C) 1996-1998 by the Board of Trustees
# of Leland Stanford Junior University.
#
# This file is part of the SimOS distribution.
# See LICENSE file for terms of the license.
#
#####
##### script to generate a list of files that only differ (cvs diff)
##### for the $Author and $Date line in the heading comment
#####
#####
##### Script does not do anything bad, but generates
##### a script that either calls for a remove of the
##### files, or echos its name
#####
##### script should be called at the top of the simulation
##### tree.
#####
##### cvs diff | elimHeaderDiffs.prl >list_of_files
$state = "nostate";
$numlines = 0;
sub MakeDecision {
if ( $state eq "nostate" ) {
return;
}
if ($state eq "remove") {
if ($numlines <=12) {
print "rm $file\n";
} else {
print "echo \"Keeping $file 'cause diff has $numlines lines\"\n";
}
} else {
print STDERR "Diff in $file: $reason \n";
print "echo \"Real diffs in $file \"\n";
}
$numlines = 1000;
}
$hasIndex = 0;
while(<>) {
$numlines++;
if (/Index: (\S+)/) {
MakeDecision();
$state = "remove";
$file = $1;
$numlines = 1;
$hasIndex = 1;
} elsif (/RCS file: \/hive\/cvsroot\/simulation\/(\S+)/) {
if (!$hasIndex) {
MakeDecision();
$state = "remove";
$file = $1;
chop($file); chop($file);
$numlines = 1;
}
} elsif (/RCS file: (\S+)/) {
if (!$hasIndex) {
MakeDecision();
$state = "remove";
$file = $1;
chop($file); chop($file);
$numlines = 1;
}
$hasIndex = 0;
} elsif (/===================================================================/) {
} elsif (/retrieving revision (\S+)/) {
} elsif (/diff -r(\d+).(\d+)/) {
} elsif (/(\d+)c(\d+)/) {
} elsif (/(\d+),(\d+)c(\d+),(\d+)/) {
} elsif (/(\S) \$Revision:/) {
} elsif (/(\S) \* \$Revision:/) {
} elsif (/(\S) \/\* \$Header:/) {
} elsif (/(\S) \* \$Header:/) {
} elsif (/(\S) \* rcsid \"\$Header:/) {
} elsif (/(\S) \* \$Author:/) {
} elsif (/(\S) \* Author: \$Author/) {
} elsif (/(\S) \* Author: \$Author:/) {
} elsif (/(\S) \* Author: \$Author:/) {
} elsif (/(\S) \* Author: \$Author:/) {
} elsif (/(\S) \* Last Modified by: \$Author:/) {
} elsif (/(\S) \* Last modified by: \$Author/) {
} elsif (/(\S) \* Author: \$Author:/) {
} elsif (/(\S) \# \$Author:/) {
} elsif (/(\S) \#\#\# \$Author:/) {
} elsif (/(\S) \* Date: \$Date:/) {
} elsif (/(\S) \* \$Date:/) {
} elsif (/(\S) \* Date: \$Date/) {
} elsif (/(\S) \* Date: \$Date:/) {
} elsif (/(\S) \# \$Date:/) {
} elsif (/(\S) \#\#\# \$Date:/) {
} elsif (/(\S) \/\* \$Id:/) {
} elsif (/(\S) \* \$Id:/) {
} elsif (/(\S) static char rcsid\[\] = \"\$Header:/) {
} elsif (/---/) {
} else {
if ($state eq "remove") {
chop($_);
$reason = $_;
$state = "keep";
}
}
}
MakeDecision();