1
0
Fork 0

Merge pull request #571 from Seldaek/fix_branch_ver

Fix branch versions to enforce context
pull/572/merge
Nils Adermann 2012-04-12 17:57:22 -07:00
commit 4701539892
5 changed files with 6 additions and 4 deletions

View File

@ -151,7 +151,7 @@ class ArrayLoader
} }
$package->setAlias($validatedTargetBranch); $package->setAlias($validatedTargetBranch);
$package->setPrettyAlias($targetBranch); $package->setPrettyAlias(preg_replace('{(\.9{7})+}', '.x', $validatedTargetBranch));
break; break;
} }
} }

View File

@ -87,6 +87,7 @@ class VersionParser
return $version; return $version;
} }
// match dev branches
if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) { if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
try { try {
return $this->normalizeBranch($match[1]); return $this->normalizeBranch($match[1]);

View File

@ -200,7 +200,7 @@ class VcsRepository extends ArrayRepository
if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) { if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
$data['version'] = 'dev-' . $data['version']; $data['version'] = 'dev-' . $data['version'];
} else { } else {
$data['version'] = $data['version'] . '-dev'; $data['version'] = preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
} }
if ($verbose) { if ($verbose) {

View File

@ -51,6 +51,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
'parses dt+patch' => array('20100102-203040-p1', '20100102-203040-patch1'), 'parses dt+patch' => array('20100102-203040-p1', '20100102-203040-patch1'),
'parses master' => array('dev-master', '9999999-dev'), 'parses master' => array('dev-master', '9999999-dev'),
'parses trunk' => array('dev-trunk', '9999999-dev'), 'parses trunk' => array('dev-trunk', '9999999-dev'),
'parses branches' => array('1.x-dev', '1.9999999.9999999.9999999-dev'),
'parses arbitrary' => array('dev-feature-foo', 'dev-feature-foo'), 'parses arbitrary' => array('dev-feature-foo', 'dev-feature-foo'),
'parses arbitrary2' => array('DEV-FOOBAR', 'dev-foobar'), 'parses arbitrary2' => array('DEV-FOOBAR', 'dev-foobar'),
'ignores aliases' => array('dev-master as 1.0.0', '1.0.0.0'), 'ignores aliases' => array('dev-master as 1.0.0', '1.0.0.0'),

View File

@ -87,7 +87,7 @@ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase
$process->execute('git branch 1.0', $null); $process->execute('git branch 1.0', $null);
// add 1.0.x branch // add 1.0.x branch
$process->execute('git branch 1.0.x', $null); $process->execute('git branch 1.1.x', $null);
// update master to 2.0 // update master to 2.0
$composer['version'] = '2.0.0'; $composer['version'] = '2.0.0';
@ -116,8 +116,8 @@ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase
$expected = array( $expected = array(
'0.6.0' => true, '0.6.0' => true,
'1.0.0' => true, '1.0.0' => true,
'1.0-dev' => true,
'1.0.x-dev' => true, '1.0.x-dev' => true,
'1.1.x-dev' => true,
'dev-feature-b' => true, 'dev-feature-b' => true,
'dev-feature-a' => true, 'dev-feature-a' => true,
'dev-master' => true, 'dev-master' => true,