From 63d52b3e1b6fd8ddfc81d0aa190edc0f890fa589 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 20 Nov 2011 21:13:17 +0100 Subject: [PATCH] Minor fixes to allow branch -dev versions --- src/Composer/Package/Dumper/ArrayDumper.php | 1 + src/Composer/Package/Loader/ArrayLoader.php | 7 ++++++- src/Composer/Repository/VcsRepository.php | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Composer/Package/Dumper/ArrayDumper.php b/src/Composer/Package/Dumper/ArrayDumper.php index 480864b68..c944813a3 100644 --- a/src/Composer/Package/Dumper/ArrayDumper.php +++ b/src/Composer/Package/Dumper/ArrayDumper.php @@ -41,6 +41,7 @@ class ArrayDumper $data = array(); $data['name'] = $package->getPrettyName(); $data['version'] = $package->getPrettyVersion(); + $data['version_normalized'] = $package->getVersion(); if ($package->getTargetDir()) { $data['target-dir'] = $package->getTargetDir(); } diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index f63ecfc3c..b4312c015 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -45,7 +45,12 @@ class ArrayLoader public function load($config) { $prettyVersion = isset($config['version']) ? $config['version'] : '0.0.0'; - $version = $this->versionParser->normalize($prettyVersion); + // handle already normalized versions + if (isset($config['version_normalized'])) { + $version = $config['version_normalized']; + } else { + $version = $this->versionParser->normalize($prettyVersion); + } $package = new Package\MemoryPackage(isset($config['name']) ? $config['name'] : '__app__', $version, $prettyVersion); $package->setType(isset($config['type']) ? $config['type'] : 'library'); diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php index 5e13ac151..481701d86 100644 --- a/src/Composer/Repository/VcsRepository.php +++ b/src/Composer/Repository/VcsRepository.php @@ -96,7 +96,7 @@ class VcsRepository extends ArrayRepository } if ($debug) { - echo 'Importing tag '.$tag.PHP_EOL; + echo 'Importing tag '.$tag.' ('.$data['version_normalized'].')'.PHP_EOL; } $this->addPackage($loader->load($this->preProcess($driver, $data, $identifier))); @@ -136,7 +136,7 @@ class VcsRepository extends ArrayRepository } if ($debug) { - echo 'Importing branch '.$branch.PHP_EOL; + echo 'Importing branch '.$branch.' ('.$data['version_normalized'].')'.PHP_EOL; } $this->addPackage($loader->load($this->preProcess($driver, $data, $identifier)));