more work on perms handling

This commit is contained in:
Ward Wouts 2004-01-22 20:47:12 +00:00
parent b78feb8da3
commit 78768a35fe

View file

@ -61,7 +61,7 @@ if ( $cvspath ) {
foreach ( @ARGV ) { foreach ( @ARGV ) {
if ( -f $_ ) { if ( -f $_ ) {
&incvs($_); # check if file exists in cvs else make it so &incvs($_); # check if file exists in cvs else make it so
&inperms($_); # check if file perms are registered or make it so next unless &inperms($_); # check if file perms are registered or make it so
unless (&cmptocvs($_)) { # compare file to cvs unless (&cmptocvs($_)) { # compare file to cvs
print "$_ not in sync with cvs version\n"; print "$_ not in sync with cvs version\n";
print "please fix this\n"; print "please fix this\n";
@ -99,7 +99,7 @@ if ( $cvspath ) {
} }
sub cmdline { sub cmdline {
getopts("eh", \%option); getopts("ehp", \%option);
if ( $option{h} ) { &help; } if ( $option{h} ) { &help; }
if ( scalar(@ARGV) == 0 ) { &help; } if ( scalar(@ARGV) == 0 ) { &help; }
@ -198,17 +198,29 @@ EOT
my $perms = &slurp($permsfile); my $perms = &slurp($permsfile);
if ( $perms =~ /^(\d{4}):([^-:][^:]*):([^:]+?):$fullname$/o ) { if ( $perms =~ /^(\d{4}):([^-:][^:]*):([^:]+?):$fullname$/o ) {
# check perms if ( $1 eq $mode && $2 eq $user && $3 eq $group ) {
# update als optie -p anders file skippen return 1;
} elsif ( $option{p} ){
$perms =~ s/^(\d{4}):([^-:][^:]*):([^:]+?):$fullname$/$mode:$user:$group:$filename/o;
open(FH, ">>$permsfile");
print FH $perms;
close FH;
return 1;
} else {
print "$_ perms not in sync with registered version\n";
print "please fix this\n";
print "press enter to continue\n";
my $line = <>;
return 0;
}
} else { } else {
open(FH, ">>$permsfile"); open(FH, ">>$permsfile");
print FH "$mode:$user:$group:$fullname\n"; print FH "$mode:$user:$group:$fullname\n";
close FH; close FH;
system("$cvscmd ci -m \"adding $fullname\" $permsfile"); system("$cvscmd ci -m \"adding $fullname\" $permsfile");
return 1;
} }
print "$path\n";
exit;
} }
sub edit($) { sub edit($) {