Mozilla/CVSROOT/commitcheck.pl
terry%netscape.com f435b2615c Pseudo-automatic update of changes made by terry@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@5489 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-14 17:17:52 +00:00

122 lines
2.9 KiB
Perl
Executable File

#!/tools/ns/bin/perl5.004 --
# DO NOT EDIT THIS FILE! You must instead go to http://warp/mozilla.org, and
# tweak things from there.
$mode{'2'} = 'Open';
$branch{'2'} = 'HEAD';
$fullname{'2'} = 'fo';
$mode{'1'} = 'Open';
$branch{'1'} = 'HEAD';
$fullname{'1'} = 'foo';
sub GetT {
($b,$_) = (@_);
return '';
}
$debug = 0;
$origrepository = shift(@ARGV);
@files = @ARGV;
$envcvsroot = $ENV{'CVSROOT'};
open( REP, "<CVS/Repository");
$repository = <REP>;
chop($repository);
close(REP);
$repository =~ s:^$envcvsroot/::;
$doit = 0;
$| = 1;
if( $debug){
print STDERR "----------------------------------------------\n";
print STDERR "files: @files\n";
print STDERR "origrepository: $origrepository\n";
print STDERR " repository: $repository\n";
print STDERR "----------------------------------------------\n";
}
open(ENT, "<CVS/Entries" );
while( <ENT> ){
chop;
($d,$fn,$rev,$mod_time,$sticky,$tag) = split(/\//);
$fbranch{$fn} = $sticky;
}
close ENT;
foreach $f (@files) {
$b = "";
if (defined $fbranch{$f}) {$b = $fbranch{$f};}
if ($b eq "") {$b = "HEAD";}
$t = GetT($b, "$repository/$f");
if ($debug) {
print STDERR "GetT returned '$t' for '$repository/$f' branch '$b'\n";
}
if ($t eq "") {
$t = "default";
}
if (!defined $mode{$t} || $mode{$t} eq "Open") {
next;
}
if ($debug) {
print STDERR "Checking twig $t\n";
}
# OK, we have a match. See if we're allowed to checkin here.
if ($username eq "") {
$username = $ENV{"CVS_USER"} || getlogin || (getpwuid($<))[0] || "nobody";
if ($debug) {
print STDERR "Username is $username\n";
print STDERR "getlogin returns " . getlogin . "\n";
print STDERR '(getpwuid($<))[0] returns ' . (getpwuid($<))[0] . "\n";
print STDERR "Environment:\n";
foreach $key (sort(keys %ENV)) {
print STDERR $key, '=', $ENV{$key}, "\n";
}
}
}
$ok = 0;
$s = $super{$t};
foreach $u (@$s) {
if ($debug) {
print STDERR "Checking against super $u\n";
}
if ($u eq $username) {
$ok = 1;
break;
}
}
if ($mode{$t} eq "Restricted") {
$b = $blessed{$t};
foreach $u (@$b) {
if ($debug) {
print STDERR "Checking against blessed $u\n";
}
if ($u eq $username) {
$ok = 1;
break;
}
}
}
if (!$ok) {
print STDERR "You may not check into partition $fullname{$t}.\n";
print STDERR "If you think you should be allowed to, send mail to\n";
print STDERR "one of the below people:\n";
$s = $super{$t};
foreach $u (@$s) {
$u =~ s/%/@/;
print STDERR " $u\n";
}
exit 1;
}
}
exit 0;