Fix version guessing regression and a few other issues, fixes #7127
parent
79d62cc51c
commit
9041622b86
|
@ -184,7 +184,7 @@ class VersionGuesser
|
||||||
$isFeatureBranch = 0 === strpos($version, 'dev-');
|
$isFeatureBranch = 0 === strpos($version, 'dev-');
|
||||||
|
|
||||||
if ('9999999-dev' === $version) {
|
if ('9999999-dev' === $version) {
|
||||||
$version = 'dev-' . $branch;
|
return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$isFeatureBranch) {
|
if (!$isFeatureBranch) {
|
||||||
|
@ -240,9 +240,6 @@ class VersionGuesser
|
||||||
$length = strlen($output);
|
$length = strlen($output);
|
||||||
$version = $this->versionParser->normalizeBranch($candidate);
|
$version = $this->versionParser->normalizeBranch($candidate);
|
||||||
$prettyVersion = 'dev-' . $match[1];
|
$prettyVersion = 'dev-' . $match[1];
|
||||||
if ('9999999-dev' === $version) {
|
|
||||||
$version = $prettyVersion;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,10 +257,6 @@ class VersionGuesser
|
||||||
$branch = trim($output);
|
$branch = trim($output);
|
||||||
$version = $this->versionParser->normalizeBranch($branch);
|
$version = $this->versionParser->normalizeBranch($branch);
|
||||||
$prettyVersion = 'dev-' . $branch;
|
$prettyVersion = 'dev-' . $branch;
|
||||||
|
|
||||||
if ('9999999-dev' === $version) {
|
|
||||||
$version = $prettyVersion;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to fetch current version from fossil tags
|
// try to fetch current version from fossil tags
|
||||||
|
@ -295,9 +288,6 @@ class VersionGuesser
|
||||||
// we are in a branches path
|
// we are in a branches path
|
||||||
$version = $this->versionParser->normalizeBranch($matches[3]);
|
$version = $this->versionParser->normalizeBranch($matches[3]);
|
||||||
$prettyVersion = 'dev-' . $matches[3];
|
$prettyVersion = 'dev-' . $matches[3];
|
||||||
if ('9999999-dev' === $version) {
|
|
||||||
$version = $prettyVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
|
return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
|
||||||
|
|
||||||
if (!isset($package['version'])) {
|
if (!isset($package['version'])) {
|
||||||
$versionData = $this->versionGuesser->guessVersion($package, $path);
|
$versionData = $this->versionGuesser->guessVersion($package, $path);
|
||||||
$package['version'] = $versionData['version'] ?: 'dev-master';
|
$package['version'] = $versionData['pretty_version'] ?: 'dev-master';
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
|
@ -89,7 +89,8 @@ class VersionGuesserTest extends TestCase
|
||||||
$guesser = new VersionGuesser($config, $executor, new VersionParser());
|
$guesser = new VersionGuesser($config, $executor, new VersionParser());
|
||||||
$versionArray = $guesser->guessVersion(array(), 'dummy/path');
|
$versionArray = $guesser->guessVersion(array(), 'dummy/path');
|
||||||
|
|
||||||
$this->assertEquals('dev-' . $branch, $versionArray['version']);
|
$this->assertEquals("9999999-dev", $versionArray['version']);
|
||||||
|
$this->assertEquals("dev-".$branch, $versionArray['pretty_version']);
|
||||||
$this->assertEmpty($versionArray['commit']);
|
$this->assertEmpty($versionArray['commit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue