From e072607e9096c4e9b9a6d1df8be0404a39ce843f Mon Sep 17 00:00:00 2001 From: Konstantin Tjuterev Date: Tue, 6 Mar 2012 19:21:45 +0200 Subject: [PATCH 1/2] More descriptive exceptions wording --- src/Composer/Compiler.php | 2 +- src/Composer/Downloader/GitDownloader.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 5e77bbf9e..e80a63d78 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -37,7 +37,7 @@ class Compiler $process = new Process('git log --pretty="%h" -n1 HEAD'); if ($process->run() != 0) { - throw new \RuntimeException('The git binary cannot be found.'); + throw new \RuntimeException('The git binary cannot be found or compile was run not inside git repository folder.'); } $this->version = trim($process->getOutput()); diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index 4e0ea0c29..85a6afe8f 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -60,7 +60,7 @@ class GitDownloader extends VcsDownloader } if (trim($output)) { - throw new \RuntimeException('Source directory has uncommitted changes'); + throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes'); } } } From 49491a914051409133f23d9289cfe0ca6fbe990d Mon Sep 17 00:00:00 2001 From: Konstantin Tjuterev Date: Wed, 7 Mar 2012 10:06:03 +0200 Subject: [PATCH 2/2] Added path to exceptions thrown in enforceCleanDirectory for Hg & Svn also; Imporved exception when git log cannot be run by Compiler --- src/Composer/Compiler.php | 4 ++-- src/Composer/Downloader/HgDownloader.php | 2 +- src/Composer/Downloader/SvnDownloader.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index e80a63d78..86c6ffb44 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -35,9 +35,9 @@ class Compiler unlink($pharFile); } - $process = new Process('git log --pretty="%h" -n1 HEAD'); + $process = new Process('git log --pretty="%h" -n1 HEAD', __DIR__); if ($process->run() != 0) { - throw new \RuntimeException('The git binary cannot be found or compile was run not inside git repository folder.'); + throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.'); } $this->version = trim($process->getOutput()); diff --git a/src/Composer/Downloader/HgDownloader.php b/src/Composer/Downloader/HgDownloader.php index 768280845..629883dc8 100644 --- a/src/Composer/Downloader/HgDownloader.php +++ b/src/Composer/Downloader/HgDownloader.php @@ -50,7 +50,7 @@ class HgDownloader extends VcsDownloader { $this->process->execute(sprintf('cd %s && hg st', escapeshellarg($path)), $output); if (trim($output)) { - throw new \RuntimeException('Source directory has uncommitted changes'); + throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes'); } } } diff --git a/src/Composer/Downloader/SvnDownloader.php b/src/Composer/Downloader/SvnDownloader.php index e0bb915f6..28d3e2101 100644 --- a/src/Composer/Downloader/SvnDownloader.php +++ b/src/Composer/Downloader/SvnDownloader.php @@ -51,7 +51,7 @@ class SvnDownloader extends VcsDownloader { $this->process->execute(sprintf('cd %s && svn status', escapeshellarg($path)), $output); if (trim($output)) { - throw new \RuntimeException('Source directory has uncommitted changes'); + throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes'); } } } \ No newline at end of file