Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
cvsimport: Improve usage error reporting
author
Frank Lichtenheld
<frank@lichtenheld.de>
Fri, 6 Apr 2007 21:52:41 +0000
(23:52 +0200)
committer
Junio C Hamano
<junkio@cox.net>
Fri, 6 Apr 2007 23:46:11 +0000
(16:46 -0700)
Actually tell the user what he did wrong in case of usage errors
instead of only printing the general usage information.
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-cvsimport.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
407049c
)
diff --git
a/git-cvsimport.perl
b/git-cvsimport.perl
index d3fbcbc15cc2f251fe22c8995f962bc609456d1a..ac74bc51b3197d06f13f588d6916400ac3e6fcf0 100755
(executable)
--- a/
git-cvsimport.perl
+++ b/
git-cvsimport.perl
@@
-32,7
+32,9
@@
our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L, $opt_a);
my (%conv_author_name, %conv_author_email);
our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L, $opt_a);
my (%conv_author_name, %conv_author_email);
-sub usage() {
+sub usage(;$) {
+ my $msg = shift;
+ print(STDERR "Error: $msg\n") if $msg;
print STDERR <<END;
Usage: ${\basename $0} # fetch/update GIT from CVS
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
print STDERR <<END;
Usage: ${\basename $0} # fetch/update GIT from CVS
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
@@
-117,7
+119,7
@@
sub read_repo_config {
getopts($opts) or usage();
usage if $opt_h;
getopts($opts) or usage();
usage if $opt_h;
-@ARGV <= 1 or usage();
+@ARGV <= 1 or usage(
"You can't specify more than one CVS module"
);
if ($opt_d) {
$ENV{"CVSROOT"} = $opt_d;
if ($opt_d) {
$ENV{"CVSROOT"} = $opt_d;
@@
-130,7
+132,7
@@
sub read_repo_config {
} elsif ($ENV{"CVSROOT"}) {
$opt_d = $ENV{"CVSROOT"};
} else {
} elsif ($ENV{"CVSROOT"}) {
$opt_d = $ENV{"CVSROOT"};
} else {
-
die "CVSROOT needs to be set"
;
+
usage("CVSROOT needs to be set")
;
}
$opt_o ||= "origin";
$opt_s ||= "-";
}
$opt_o ||= "origin";
$opt_s ||= "-";
@@
-149,7
+151,7
@@
sub read_repo_config {
chomp $cvs_tree;
close $f;
} else {
chomp $cvs_tree;
close $f;
} else {
- usage();
+ usage(
"CVS module has to be specified"
);
}
our @mergerx = ();
}
our @mergerx = ();