[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS editors
From: |
Colm Murphy |
Subject: |
CVS editors |
Date: |
Thu, 14 Feb 2002 15:08:23 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; WinNT4.0; en-GB; rv:0.9.4) Gecko/20011019 Netscape6/6.2 |
Hi folks,
I have written a simple perl subroutine which you can use to see who is
editing which files without having to do a checkout.
Feel free to use it if you think it is useful for you.
Regards
Colm A
#-------------------------------------------------------------------------------
# Builds a list of who is editing what files.
# Paramaters:
# $_[0]: path to CVSROOT
# $_[1]: set if you want full paths to files.
#-------------------------------------------------------------------------------
sub build_editors {
my $cvsroot = $_[0];
my %editors;
my @filelist = `find $cvsroot -name "fileattr"`;
chomp @filelist;
foreach my $filename (@filelist)
{
# $dirpath is the path to the directory in the repository.
$dirpath = $filename;
$dirpath =~ s/$cvsroot\///;
$dirpath =~ s/CVS\/fileattr//;
open (FILE, $filename) or die "Cannot open $filename: $!";
while (defined(my $line = <FILE>))
{
(my $file, my $rest) = split (/\t/,$line);
# Remove the leading F in the filename.
# This indicates to CVS that the watched object is a file.
$file =~ s/^F//;
# We now add back in the path to the file in the repository.
$file = $dirpath.$file if ($_[1]);
my @attrlist = split (/;/,$rest);
foreach my $attr (@attrlist)
{
if ($attr =~ /^_watched/)
{
# print "$file is watched\n";
}
elsif ($attr =~ /^_watchers/)
{
my $watcherstring = $attr;
$watcherstring =~ s/_watchers=//;
my @watcherlist = split (/,/,$watcherstring);
foreach my $watcher (@watcherlist)
{
(my $watchername, my $editordetails) = split
(/>/,$watcher);
# print "Watcher:$watchername\n";
# print "Details:$editordetails\n";
}
}
elsif ($attr =~ /^_editors/)
{
my $editorstring = $attr;
$editorstring =~ s/_editors=//;
$editors{$file} = $editorstring;
# @editorlist = split (/,/,$editorstring);
# foreach $editor (@editorlist)
# {
# ($editorname, $editordetails) = split (/>/,$editor);
# print "Editor:$editorname\n";
# print "Details:$editordetails\n";
# }
}
}
}
close (FILE) or die "Cannot close $filename: $!";
}
# foreach $file (sort keys %editors)
# {
# print "FILE:$file\n";
# print "ATTR:$editors{$file}\n";
# }
return %editors;
}
#-------------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- CVS editors,
Colm Murphy <=