aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoridl0r <idl0r@gentoo.org>2009-09-12 11:50:43 +0000
committeridl0r <idl0r@gentoo.org>2009-09-12 11:50:43 +0000
commitf08ba2a9455b6af64faa0ce97831a1eca47a093a (patch)
tree6b8eb215daf65f0707a5f55d76e8d96f58f5a375
parentFix bug 284657, thanks to Andrew Gaffney <agaffney@gentoo.org>. (diff)
downloadgentoolkit-f08ba2a9455b6af64faa0ce97831a1eca47a093a.tar.gz
gentoolkit-f08ba2a9455b6af64faa0ce97831a1eca47a093a.tar.bz2
gentoolkit-f08ba2a9455b6af64faa0ce97831a1eca47a093a.zip
Cleanup VCS detection.
svn path=/trunk/gentoolkit-dev/; revision=681
-rw-r--r--ChangeLog1
-rwxr-xr-xsrc/echangelog/echangelog63
2 files changed, 34 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 50bf5ec..4905c24 100644
--- 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.
diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 83561aa..039e5f3 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -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