Here is a script we use to list all tags in a module.
It can also be used to return a list of files for a given tag.
Colm A
#!/usr/local/bin/perl -w
##################################################################################
Description : Prints either a list of tags for a module or a list of
files for a tag.
# taginfo operates on files in the repository.!!
# Use rtaginfo to view tags for files in your sandbox.
#
#################################################################################
#------------------------------------------------------------------------------
# Parameters
#------------------------------------------------------------------------------
$usageinfo = "Usage: rtaginfo -t <module>|<dir>\n";
$usageinfo = $usageinfo."or: rtaginfo -f <Tag>\n";
$usageinfo = $usageinfo." -t <module>|<dir> Print a list of tags
used in module or dir\n";
$usageinfo = $usageinfo." -f <tag> Print a list of all
files containing tag\n";
$usageinfo = $usageinfo." This option requires
the Everything module to be defined.\n";
$usageinfo = $usageinfo."\nUse taginfo to view tags in your sandbox.\n";
$modulelist = "";
if (@ARGV >= 2)
{
if ($ARGV[0] eq "-t")
{
$mode = "show_tags";
for $i (1..$#ARGV)
{
$modulelist = $modulelist."$ARGV[$i] ";
}
}
elsif ($ARGV[0] eq "-f")
{
$mode = "show_files";
$chosentag = $ARGV[1];
$modulelist = "Everything";
if (@ARGV > 2)
{
print $usageinfo;
exit;
}
}
else
{
print $usageinfo;
exit;
}
}
else
{
print $usageinfo;
exit;
}
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Parse the logfile
#------------------------------------------------------------------------------
parselog();
if ($mode eq "show_tags")
{
print "----------------------------------------\n";
print "$modulelist contain the following tags\n";
print "----------------------------------------\n";
map{ print "$_\n"; } (sort keys %tagdetails);
print "----------------------------------------\n";
}
elsif ($mode eq "show_files")
{
if ($tagdetails{$chosentag})
{
print "----------------------------------------\n";
print "The following files contain the tag $chosentag \n";
print "----------------------------------------\n";
@filelist = split (/,/,$tagdetails{$chosentag});
foreach $file (@filelist)
{
print "$file\n";
}
print "----------------------------------------\n";
}
else
{
print "Found no files containing the tag $chosentag \n";
}
}
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Subroutine: parselog
#
#------------------------------------------------------------------------------
sub parselog
{
my $Flag = 0;
print "Running cvs rlog. This may take some time ... \n";
open(CVS_LOG," cvs -q rlog $modulelist|")
|| die "Problems running cvs -q rlog $modulelist !\n";
# $x is a control variable for the rotating bar indicating that
program is still alive.
$x =0;
# Flushing the output making bar really rotating.
$| = 1;
while ( defined ($line = <CVS_LOG> ) )
{
if($line =~ /^RCS file:\s(\S+),v/)
{
$rcsfile = $1;
}
if($line =~ /symbolic names:/)
{
$Flag = 1;
next;
}
if( $Flag )
{
if($line !~ /^\s+(\S+):\s(\S+)$/ )
{
$Flag = 0;
next;
}
$tagdetails{$1} = "$tagdetails{$1},$rcsfile:$2";
}
# This breathtaking rotating star ...
# Octal \010 is backspace character code.
if ( ($x % 40) == 1)
{
print "\010\/";
}
elsif ( ($x % 40) == 11)
{
print "\010|";
}
elsif ( ($x % 40) == 21)
{
print "\010\\";
}
elsif ( ($x % 40) == 31)
{
print "\010-";
}
elsif ($x == 41)
{
$x=0;
}
$x++;
}
# Closing the pipe from 'cvs log'.
close (CVS_LOG);
return;
}
#------------------------------------------------------------------------------
E B wrote:
> To get all tags for a module, the archives suggest
> using cvs log filename (for some filename).
> But this file might not have been there all
> throughout the module's history. So is there
> any another way of getting all the tags for a module?
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
>
_______________________________________________
Info-cvs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/info-cvs