Mozilla/CVSROOT/commitcheck.pl
despotdaemon%netscape.com 1f07d788eb Pseudo-automatic update of changes made by terry@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@12269 18797224-902f-48f8-a5cc-f745e15eee43
1998-10-08 06:07:11 +00:00

160 lines
4.1 KiB
Perl
Executable File

#!/tools/ns/bin/perl5.004 --
# DO NOT EDIT THIS FILE! You must instead go to http://cvs-mirror.mozilla.org/webtools/despot, and
# tweak things from there.
$mode{'15'} = 'Restricted';
$branch{'15'} = 'ColorSync_19980824_BRANCH';
$fullname{'15'} = 'ColorSync Branch';
$blessed{'15'} = [];
$super{'15'} = ['ebb3%apple.com','pinkerton%netscape.com','pnunn%netscape.com','saari%netscape.com',];
$mode{'4'} = 'Open';
$branch{'4'} = 'HEAD';
$fullname{'4'} = 'default';
$defaultid = '4';
$mode{'3'} = 'Closed';
$branch{'3'} = 'HEAD';
$fullname{'3'} = 'despotaccess';
$blessed{'3'} = [];
$super{'3'} = ['despotdaemon%netscape.com',];
$mode{'21'} = 'Open';
$branch{'21'} = 'HEAD';
$fullname{'21'} = 'gnomefe';
$mode{'12'} = 'Open';
$branch{'12'} = 'HEAD';
$fullname{'12'} = 'jpeg';
$mode{'18'} = 'Open';
$branch{'18'} = 'HEAD';
$fullname{'18'} = 'macfe';
$mode{'19'} = 'Open';
$branch{'19'} = 'HEAD';
$fullname{'19'} = 'mozilla-toplevel';
$mode{'24'} = 'Restricted';
$branch{'24'} = 'HEAD';
$fullname{'24'} = 'nsprpub';
$blessed{'24'} = [];
$super{'24'} = ['warren%netscape.com','wtc%netscape.com','srinivas%netscape.com','larryh%netscape.com',];
sub GetT {
($b,$_) = (@_);
if ($b eq 'ColorSync_19980824_BRANCH') {
}
if ($b eq 'HEAD') {
if (m:^CVSROOT/commitcheck\.pl$:) {return '3';}
if (m:^CVSROOT/passwd$:) {return '3';}
if (m:^jpeg/.*$:) {return '12';}
if (m:^mozilla/[^/]*$:) {return '19';}
if (m:^mozilla/cmd/gnomefe/.*$:) {return '21';}
if (m:^nsprpub/.*$:) {return '24';}
}
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(/\//);
if ($tag =~ /^T(.*)$/) {
$fbranch{$fn} = $1;
}
}
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 = $defaultid;
}
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 "the file $repository/$f on branch $b\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;