|
From: | Colm Murphy |
Subject: | Re: Listing available tags |
Date: | Thu, 24 Jan 2002 14:42:18 +0000 |
User-agent: | Mozilla/5.0 (Windows; U; WinNT4.0; en-GB; rv:0.9.4) Gecko/20011019 Netscape6/6.2 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |