From 850b591d6cf0be87608ab6b99152cf67bb9ec658 Mon Sep 17 00:00:00 2001 From: idl0r Date: Tue, 2 Feb 2010 18:26:13 +0000 Subject: [PATCH] echangelog: Add --vcs switch to specify the vcs without autodetection as requested per bug 302784, thanks to Martin von Gagern . Sort the VCS during autodetection. svn path=/trunk/gentoolkit-dev/; revision=738 --- ChangeLog | 5 +++++ src/echangelog/echangelog | 28 +++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0b8c20..cfe5d03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-02-02: Christian Ruppert + src/echangelog/echangelog: Add --vcs switch to specify the vcs without + autodetection as requested per bug 302784, thanks to Martin von Gagern + . Sort the VCS during autodetection. + 2010-01-02: Christian Ruppert src/echangelog/echangelog: Improve vcs detection, might fix bug 302784 as well. diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog index 9c3818f..820614b 100755 --- a/src/echangelog/echangelog +++ b/src/echangelog/echangelog @@ -23,7 +23,7 @@ $Text::Wrap::unexpand = 0; # Global variables my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions); my ($input, $editor, $entry, $user, $date, $text, $vcs); -my ($opt_help, $opt_nostrict, $opt_version); +my ($opt_help, $opt_nostrict, $opt_force_vcs, $opt_version); $opt_help = 0; $opt_nostrict = 0; @@ -86,7 +86,11 @@ sub usage { Options: --help err, this screen ... --no-strict do not abort on trivial/no changes + --vcs skip vcs autodetection and use the specified vcs instead + for a list of supported version control systems see below --version show version info + + Supported VCS: bzr, cvs, git, hg, svn EOF print $usage; exit 0; @@ -207,7 +211,8 @@ sub mypush(\@@) { GetOptions( 'help' => \$opt_help, 'no-strict' => \$opt_nostrict, - 'version' => \$opt_version, + 'vcs=s' => \$opt_force_vcs, + 'version|v' => \$opt_version, 'strict' => \$opt_strict, ); @@ -221,17 +226,22 @@ if($opt_strict) { # Figure out what kind of repo we are in. # Respect $PATH while looking for the VCS -if (getenv("PATH")) { - foreach my $path ( split(":", getenv("PATH")) ) { - foreach my $_vcs (keys(%vcs)) { - if ( -X "${path}/${_vcs}" ) { - $vcs = $_vcs if check_vcs_dir($vcs{$_vcs}{directory}); - last if $vcs; +if(! defined($opt_force_vcs)) { + if (getenv("PATH")) { + foreach my $path ( split(":", getenv("PATH")) ) { + foreach my $_vcs (sort(keys(%vcs))) { + if ( -X "${path}/${_vcs}" ) { + $vcs = $_vcs if check_vcs_dir($vcs{$_vcs}{directory}); + last if $vcs; + } } + last if $vcs; } - last if $vcs; } } +else { + $vcs = $opt_force_vcs if defined $vcs{$opt_force_vcs}; +} if ( ! $vcs ) { print STDERR "Either no CVS, .git, .svn, ... directories found, the specific VCS has not been\n"; -- 2.26.2