Merge pull request #571 from Seldaek/fix_branch_ver
Fix branch versions to enforce contextpull/572/merge
commit
4701539892
|
@ -151,7 +151,7 @@ class ArrayLoader
|
|||
}
|
||||
|
||||
$package->setAlias($validatedTargetBranch);
|
||||
$package->setPrettyAlias($targetBranch);
|
||||
$package->setPrettyAlias(preg_replace('{(\.9{7})+}', '.x', $validatedTargetBranch));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,7 @@ class VersionParser
|
|||
return $version;
|
||||
}
|
||||
|
||||
// match dev branches
|
||||
if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
|
||||
try {
|
||||
return $this->normalizeBranch($match[1]);
|
||||
|
|
|
@ -200,7 +200,7 @@ class VcsRepository extends ArrayRepository
|
|||
if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
|
||||
$data['version'] = 'dev-' . $data['version'];
|
||||
} else {
|
||||
$data['version'] = $data['version'] . '-dev';
|
||||
$data['version'] = preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
|
|
|
@ -51,6 +51,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
|
|||
'parses dt+patch' => array('20100102-203040-p1', '20100102-203040-patch1'),
|
||||
'parses master' => array('dev-master', '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 arbitrary2' => array('DEV-FOOBAR', 'dev-foobar'),
|
||||
'ignores aliases' => array('dev-master as 1.0.0', '1.0.0.0'),
|
||||
|
|
|
@ -87,7 +87,7 @@ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase
|
|||
$process->execute('git branch 1.0', $null);
|
||||
|
||||
// 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
|
||||
$composer['version'] = '2.0.0';
|
||||
|
@ -116,8 +116,8 @@ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase
|
|||
$expected = array(
|
||||
'0.6.0' => true,
|
||||
'1.0.0' => true,
|
||||
'1.0-dev' => true,
|
||||
'1.0.x-dev' => true,
|
||||
'1.1.x-dev' => true,
|
||||
'dev-feature-b' => true,
|
||||
'dev-feature-a' => true,
|
||||
'dev-master' => true,
|
||||
|
|
Loading…
Reference in New Issue