Hi Duncan,

Here is a script that will return all tags used in a module or directory

Colm A

#!/usr/local/bin/perl -w
#------------------------------------------------------------------------------
# Parameters
#------------------------------------------------------------------------------
$modulelist = "";
if (@ARGV >= 1)
{
    foreach $arg (@ARGV)
    {
       $modulelist = $modulelist."$arg ";
    }
}
else
{
    print "Format is show_tags.pl <MODULE LIST>|<DIRECTORY LIST>\n";
    exit;
}
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Perform a cvs rlog to generate logfile.
#------------------------------------------------------------------------------
$datestamp=`date +%d-%m-%y-%H-%M`;
chomp $datestamp;
$logfile = $datestamp."log";

print "Running cvs rlog. This may take some time ... \n";
`cvs -q rlog $modulelist > $logfile`;
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Parse the logfile
#------------------------------------------------------------------------------
parselog($logfile);
print "----------------------------------------\n";
print "Tags used in $modulelist\n";
print "----------------------------------------\n";
map{ print "$_\n"; } (sort keys %tagdetails);
#------------------------------------------------------------------------------

#Remove the logfile
unlink ($logfile);

#------------------------------------------------------------------------------
# Subroutine: parselog
#
#------------------------------------------------------------------------------
sub parselog
{

    my $Flag = 0;
    my $filename;

    $filename = $_[0];

    open (FILE, $filename) or die "Cannot open $filename: $!";

    while (defined($line = <FILE>))
    {
       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";
       }
    }
    close (FILE) or die "Cannot close $filename: $!";
    return;
}
#------------------------------------------------------------------------------



Larry Jones wrote:

> Duncan Sommerville writes [in very long lines]:
> 
>>Is is possible to list all the tags associated with a project, without
>>actually checking the project out and checking individual files?
>>
> 
> CVS doesn't have projects -- I assume you mean either a directory or a
> module.  And the simply answer to your question is "no", CVS doesn't
> associate tags with anything other than individual files.  You can,
> however, use the rlog command to check individual files, or directories
> or modules of files without checking them out.
> 
> -Larry Jones
> 
> The living dead don't NEED to solve word problems. -- Calvin
> 
> 

_______________________________________________
Info-cvs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/info-cvs

Reply via email to