Browse Source

Minor tweaks refs #4878

Jordi Boggiano 9 years ago
parent
commit
d347e1efca

+ 9 - 4
src/Composer/Downloader/DownloadManager.php

@@ -252,14 +252,19 @@ class DownloadManager
             $target->setInstallationSource($installationSource);
             $target->setInstallationSource($installationSource);
             try {
             try {
                 $downloader->update($initial, $target, $targetDir);
                 $downloader->update($initial, $target, $targetDir);
+
                 return;
                 return;
-            } catch (\RuntimeException $ex) {
-                if (!$this->io->isInteractive() ||
-                    !$this->io->askConfirmation('    Updating failed. Would you like to try reinstalling instead [<comment>yes</comment>]? ', true)) {
-                    throw $ex;
+            } catch (\RuntimeException $e) {
+                if (!$this->io->isInteractive()) {
+                    throw $e;
+                }
+                $this->io->writeError('<error>    Update failed ('.$e->getMessage().')');
+                if (!$this->io->askConfirmation('    Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
+                    throw $e;
                 }
                 }
             }
             }
         }
         }
+
         $downloader->remove($initial, $targetDir);
         $downloader->remove($initial, $targetDir);
         $this->download($target, $targetDir, 'source' === $installationSource);
         $this->download($target, $targetDir, 'source' === $installationSource);
     }
     }

+ 2 - 5
src/Composer/Downloader/GitDownloader.php

@@ -372,15 +372,12 @@ class GitDownloader extends VcsDownloader
     }
     }
 
 
     /**
     /**
-     * Checks if VCS metadata repository has been initialized
-     * repository example: .git|.svn|.hg
-     *
-     * @param string $path
-     * @return bool
+     * {@inheritDoc}
      */
      */
     protected function hasMetadataRepository($path)
     protected function hasMetadataRepository($path)
     {
     {
         $path = $this->normalizePath($path);
         $path = $this->normalizePath($path);
+
         return is_dir($path.'/.git');
         return is_dir($path.'/.git');
     }
     }
 }
 }

+ 1 - 5
src/Composer/Downloader/HgDownloader.php

@@ -86,11 +86,7 @@ class HgDownloader extends VcsDownloader
     }
     }
 
 
     /**
     /**
-     * Checks if VCS metadata repository has been initialized
-     * repository example: .git|.svn|.hg
-     *
-     * @param string $path
-     * @return bool
+     * {@inheritDoc}
      */
      */
     protected function hasMetadataRepository($path)
     protected function hasMetadataRepository($path)
     {
     {

+ 1 - 5
src/Composer/Downloader/PerforceDownloader.php

@@ -106,11 +106,7 @@ class PerforceDownloader extends VcsDownloader
     }
     }
 
 
     /**
     /**
-     * Checks if VCS metadata repository has been initialized
-     * repository example: .git|.svn|.hg
-     *
-     * @param string $path
-     * @return bool
+     * {@inheritDoc}
      */
      */
     protected function hasMetadataRepository($path)
     protected function hasMetadataRepository($path)
     {
     {

+ 1 - 5
src/Composer/Downloader/SvnDownloader.php

@@ -190,11 +190,7 @@ class SvnDownloader extends VcsDownloader
     }
     }
 
 
     /**
     /**
-     * Checks if VCS metadata repository has been initialized
-     * repository example: .git|.svn|.hg
-     *
-     * @param string $path
-     * @return bool
+     * {@inheritDoc}
      */
      */
     protected function hasMetadataRepository($path)
     protected function hasMetadataRepository($path)
     {
     {

+ 1 - 1
src/Composer/Downloader/VcsDownloader.php

@@ -133,7 +133,7 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa
 
 
         // print the commit logs if in verbose mode and VCS metadata is present
         // print the commit logs if in verbose mode and VCS metadata is present
         // because in case of missing metadata code would trigger another exception
         // because in case of missing metadata code would trigger another exception
-        if ($this->io->isVerbose() && $this->hasMetadataRepository($path)) {
+        if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
             $message = 'Pulling in changes:';
             $message = 'Pulling in changes:';
             $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
             $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);