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,11 +68,22 @@ if ( $cvspath ) {
next unless &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";
if ( $option{f} ) {
print "cvs update forced\n";
&cvsupdate($_);
if ( $option{e} ) {
&edit($_);
unless (&cmptocvs($_)) {
&cvsupdate($_);
}
}
} else {
print "please fix this\n"; print "please fix this\n";
print "press enter to continue\n"; print "press enter to continue\n";
my $line = <>; my $line = <>;
next; next;
} }
}
if ( $option{e} ) { if ( $option{e} ) {
&edit($_); # edit file &edit($_); # edit file
unless (&cmptocvs($_)) { # if changed... then: unless (&cmptocvs($_)) { # if changed... then:
@ -103,7 +114,7 @@ if ( $cvspath ) {
} }
sub cmdline { sub cmdline {
getopts("ehp", \%option); getopts("efhp", \%option);
if ( $option{h} ) { &help; } if ( $option{h} ) { &help; }
if ( scalar(@ARGV) == 0 ) { &help; } if ( scalar(@ARGV) == 0 ) { &help; }
@ -389,7 +400,11 @@ sub slurp($) {
sub help { sub help {
print <<EOT; 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 EOT
exit; exit;