Permalink
Browse files

Merge remote-tracking branch 'digitalkaoz/issue_801'

Conflicts:
	src/Composer/Downloader/VcsDownloader.php
  • Loading branch information...
2 parents 2af2c27 + 68d80e1 commit 1aed88003fc9a06fb881b153ecd85816558714b5 @Seldaek Seldaek committed Aug 18, 2012
View
11 src/Composer/Downloader/GitDownloader.php 100644 → 100755
@@ -233,4 +233,15 @@ protected function setPushUrl(PackageInterface $package, $path)
$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;
+ }
}
View
11 src/Composer/Downloader/HgDownloader.php 100644 → 100755
@@ -58,4 +58,15 @@ public function getLocalChanges($path)
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;
+ }
}
View
11 src/Composer/Downloader/SvnDownloader.php 100644 → 100755
@@ -78,4 +78,15 @@ protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
);
}
}
+
+ 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;
+ }
}
View
28 src/Composer/Downloader/VcsDownloader.php
@@ -65,9 +65,25 @@ public function update(PackageInterface $initial, PackageInterface $target, $pat
throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
}
- $this->io->write(" - Updating <info>" . $target->getName() . "</info> (<comment>" . $target->getPrettyVersion() . "</comment>)");
+ if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
+ $from = $initial->getSourceReference();
+ $to = $target->getSourceReference();
+ } else {
+ $from = $initial->getPrettyVersion();
+ $to = $target->getPrettyVersion();
+ }
+
+ $this->io->write(" - Updating <info>" . $target->getName() . "</info> from (<comment>" . $from . "</comment>) to (<comment>" . $to . "</comment>)");
+
$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 @@ protected function enforceCleanDirectory($path)
* @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);
}

0 comments on commit 1aed880

Please sign in to comment.