implement force option

This commit is contained in:
Ward Wouts 2004-02-23 16:35:10 +00:00
parent d1674bc27a
commit ccbf5a8acd

View file

@ -68,10 +68,21 @@ if ( $cvspath ) {
next unless &inperms($_); # check if file perms are registered or make it so
unless (&cmptocvs($_)) { # compare file to cvs
print "$_ not in sync with cvs version\n";
print "please fix this\n";
print "press enter to continue\n";
my $line = <>;
next;
if ( $option{f} ) {
print "cvs update forced\n";
&cvsupdate($_);
if ( $option{e} ) {
&edit($_);
unless (&cmptocvs($_)) {
&cvsupdate($_);
}
}
} else {
print "please fix this\n";
print "press enter to continue\n";
my $line = <>;
next;
}
}
if ( $option{e} ) {
&edit($_); # edit file
@ -103,7 +114,7 @@ if ( $cvspath ) {
}
sub cmdline {
getopts("ehp", \%option);
getopts("efhp", \%option);
if ( $option{h} ) { &help; }
if ( scalar(@ARGV) == 0 ) { &help; }
@ -389,7 +400,11 @@ sub slurp($) {
sub help {
print <<EOT;
Usage: mycp [-e] [-h] <file1> [file2] ...";
Usage: mycp [-e] [-f] [-h] <file1> [file2] ...";
-e edit file
-f force current version into cvs
-h show this help message
EOT
exit;