diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php old mode 100644 new mode 100755 index 86a75eeab..a32a87960 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -233,4 +233,15 @@ class GitDownloader extends VcsDownloader $this->process->execute($cmd, $ignoredOutput, $path); } } + + protected function getCommitLogs($sourceReference, $targetReference, $path) + { + $command = sprintf('cd %s && git log %s..%s --pretty=format:"%%h - %%an: %%s"', escapeshellarg($path), $sourceReference, $targetReference); + + if (0 !== $this->process->execute($command, $output)) { + throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); + } + + return $output; + } } diff --git a/src/Composer/Downloader/HgDownloader.php b/src/Composer/Downloader/HgDownloader.php old mode 100644 new mode 100755 index deb748d90..d414916fd --- a/src/Composer/Downloader/HgDownloader.php +++ b/src/Composer/Downloader/HgDownloader.php @@ -58,4 +58,15 @@ class HgDownloader extends VcsDownloader return trim($output) ?: null; } + + protected function getCommitLogs($sourceReference, $targetReference, $path) + { + $command = sprintf('cd %s && hg log -r %s:%s --style compact', escapeshellarg($path), $sourceReference, $targetReference); + + if (0 !== $this->process->execute($command, $output)) { + throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); + } + + return $output; + } } diff --git a/src/Composer/Downloader/SvnDownloader.php b/src/Composer/Downloader/SvnDownloader.php old mode 100644 new mode 100755 index 39c4b8e6c..81e655fce --- a/src/Composer/Downloader/SvnDownloader.php +++ b/src/Composer/Downloader/SvnDownloader.php @@ -78,4 +78,15 @@ class SvnDownloader extends VcsDownloader ); } } + + protected function getCommitLogs($sourceReference, $targetReference, $path) + { + $command = sprintf('cd %s && svn log -r%s:%s --incremental', escapeshellarg($path), $sourceReference, $targetReference); + + if (0 !== $this->process->execute($command, $output)) { + throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); + } + + return $output; + } } diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index 5a9577672..a9821fdb9 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -65,9 +65,25 @@ abstract class VcsDownloader implements DownloaderInterface throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information'); } - $this->io->write(" - Updating " . $target->getName() . " (" . $target->getPrettyVersion() . ")"); + if ($initial->getPrettyVersion() == $target->getPrettyVersion()) { + $from = $initial->getSourceReference(); + $to = $target->getSourceReference(); + } else { + $from = $initial->getPrettyVersion(); + $to = $target->getPrettyVersion(); + } + + $this->io->write(" - Updating " . $target->getName() . " from (" . $from . ") to (" . $to . ")"); + $this->enforceCleanDirectory($path); $this->doUpdate($initial, $target, $path); + + //print the commit logs if in verbose mode + if ($this->io->isVerbose()) { + $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path); + $this->io->write($logs); + } + $this->io->write(''); } @@ -119,4 +135,14 @@ abstract class VcsDownloader implements DownloaderInterface * @return string|null changes or null */ abstract public function getLocalChanges($path); + + /** + * Fetches the commit logs between two commits + * + * @param string $fromReference the source reference + * @param string $toReference the target reference + * @param string $path the package path + * @return string + */ + abstract protected function getCommitLogs($fromReference, $toReference, $path); }