Cleanup VCS detection.
authoridl0r <idl0r@gentoo.org>
Sat, 12 Sep 2009 11:50:43 +0000 (11:50 -0000)
committeridl0r <idl0r@gentoo.org>
Sat, 12 Sep 2009 11:50:43 +0000 (11:50 -0000)
svn path=/trunk/gentoolkit-dev/; revision=681

ChangeLog
src/echangelog/echangelog

index 50bf5ec0b1b56c569879f07b4616c43d3d4fb57f..4905c24d4027e231e3a1d8636d8bae75c5fe975f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2009-12-09: Christian Ruppert <idl0r@gentoo.org>
        * src/echangelog/echangelog: Fix bug 284657, thanks to Andrew Gaffney <agaffney@gentoo.org>.
+               Cleanup VCS detection.
 
 2009-09-09: Christian Ruppert <idl0r@gentoo.org>
        * src/imlate/imlate: Bump to 0.0.4.
index 83561aa9d9ee38b3e6c9c8e9ab6ff9c3080c167f..039e5f30e8f3c15f08268b36e667757ffd160868 100755 (executable)
@@ -193,39 +193,42 @@ usage() if $opt_help;
 version() if $opt_version;
 
 # Figure out what kind of repo we are in.
-# TODO: we might also check svn/cvs more strict.
-if ( -d "CVS" ) {
-       $vcs = "cvs";
-} elsif ( -d '.svn' ) {
-       $vcs = "svn";
-} else {
-       # Respect $PATH while looking for git
-       if (getenv("PATH")) {
-               foreach my $path ( split(":", getenv("PATH")) ) {
-                       if ( -X "$path/bzr" ) {
-                               open(BZR, '-|', "${path}/bzr root 2>/dev/null");
-                               $vcs = "bzr" if defined(<BZR>);
-                               close(BZR);
-                               last if $vcs;
-                       }
-                       if ( -X "$path/git" ) {
-                               open(GIT, '-|', "${path}/git rev-parse --git-dir 2>/dev/null");
-                               $vcs = "git" if defined(<GIT>);
-                               close(GIT);
-                               last if $vcs;
-                       }
-                       if ( -X "$path/hg" ) {
-                               open(HG, '-|', "${path}/hg root 2>/dev/null");
-                               $vcs = "hg" if defined(<HG>);
-                               close(HG);
-                               last if $vcs;
-                       }
+# Respect $PATH while looking for the VCS
+if (getenv("PATH")) {
+       foreach my $path ( split(":", getenv("PATH")) ) {
+               if ( -X "${path}/bzr" ) {
+                       open(BZR, '-|', "${path}/bzr root 2>/dev/null");
+                       $vcs = "bzr" if defined(<BZR>);
+                       close(BZR);
+                       last if $vcs;
+               }
+               if ( -X "${path}/cvs" ) {
+                       $vcs = "cvs" if -d "CVS";
+                       last if $vcs;
+               }
+               if ( -X "${path}/git" ) {
+                       open(GIT, '-|', "${path}/git rev-parse --git-dir 2>/dev/null");
+                       $vcs = "git" if defined(<GIT>);
+                       close(GIT);
+                       last if $vcs;
+               }
+               if ( -X "${path}/hg" ) {
+                       open(HG, '-|', "${path}/hg root 2>/dev/null");
+                       $vcs = "hg" if defined(<HG>);
+                       close(HG);
+                       last if $vcs;
+               }
+               if ( -X "${path}/svn" ) {
+                       $vcs = "svn" if -d ".svn";
+                       last if $vcs;
                }
        }
+}
 
-       if ( ! $vcs ) {
-               die "No CVS, .git, .svn directories found, what kind of repo is this?";
-       }
+if ( ! $vcs ) {
+       print STDERR "Either no CVS, .git, .svn, ... directories found, the specific VCS has not been\n";
+       print STDERR "installed or you don't have execute rights!\n";
+       exit(1);
 }
 
 # Read the current ChangeLog