From ccbf5a8acd81c18f1dc28b3f7b25d9aca21aedd3 Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Mon, 23 Feb 2004 16:35:10 +0000 Subject: [PATCH] implement force option --- mycp/mycp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/mycp/mycp b/mycp/mycp index 2ace1f3..fb46518 100755 --- a/mycp/mycp +++ b/mycp/mycp @@ -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 < [file2] ..."; +Usage: mycp [-e] [-f] [-h] [file2] ..."; + + -e edit file + -f force current version into cvs + -h show this help message EOT exit;