2 ################################################################################
5 # Description: This script will go through CVS looking for files that have
7 # Author: Andrew@DeFaria.com
8 # Created: Fri Dec 17 12:18:21 PST 2004
11 # (c) Copyright 2004, LynxWorks Inc., all rights reserved
13 ################################################################################
28 print "$msg\n" if $verbose;
34 print "DEBUG: $msg\n" if $debug;
40 print "ERROR: $msg\n\n" if defined $msg;
42 print "Usage: files4ecr [-v] [-d] [-l] [-x] [-u] <ecr>\n";
44 print "\t-v:\t\tTurn on verbose mode (Default: off)\n";
45 print "\t-d:\t\tTurn on debug mode (Default: off)\n";
46 print "\t-l:\t\tLocal directory only, no recursion\n";
47 print "\t-x:\t\tTurn on execute mode (Default: off)\n";
48 print "\t-u:\t\tDisplay usage\n";
49 print "\tecr\t\tECR number to search for\n";
57 # Perform a cvs log command and grep through the output
58 print "Gathering CVS info..." if $verbose;
64 } `cvs -q log $local 2>/dev/null`;
67 # Now process this array. Entries may look like:
69 # Working file: <filename>
74 # It's quite possible that there are no ECR numbers for a file. It's also
75 # possible that there is the same ECR number for multiple revisions! For
78 # Working file: <filename>
84 # In this case we want to return the <filename> and 10.2.
90 while ($_ = shift @output) {
94 if (/^Working file: (.*)/) {
96 debug "file: $filename";
97 } elsif (/^revision (.*)/) {
99 debug "revision: $revision";
100 } elsif (/^ECR Number: (\d*)$/ or
106 $files{$filename} = $revision;
107 debug "Set $filename: $revision";
109 # Now skip to next file
112 } while @output and !/Working file: /;
116 verbose "Unknown line encountered: $_\n";
124 my $filename = shift;
126 my @output = grep { /Working revision:/ } `cvs status $filename`;
128 if (defined $output [0] and $output [0] =~ /Working revision:\s*(\S*)/) {
137 if ($ARGV [0] eq "-d") {
139 } elsif ($ARGV [0] eq "-v") {
141 } elsif ($ARGV [0] eq "-l") {
143 } elsif ($ARGV [0] eq "-x") {
145 } elsif ($ARGV [0] eq "-u") {
154 Usage "No ECR specified to process" if !defined $ecr;
156 my %files = GetFiles4 $ecr, $local;
158 foreach (keys %files) {
159 my $working_revision = GetWorkingRev $_;
162 if (defined $working_revision and $working_revision eq $files{$_}) {
167 print "cvs update -r$files{$_} $_";
170 `cvs update -r$files{$_} $_`;
171 print " - Updated\n";
173 print " - Already up to date\n";
176 print "$_: $files{$_}";
179 print " - Already up to date\n";
181 print " - Out of date\n";