mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Change output range for PackageVersionParser.versionMagnitude
It's now back to returning 10000 for "1.0.0", as it was before the recent changes to allow for wrapped package version numbers and prerelease versions. Given that there are other constants in the cost function used in the constraint solver, this gives us much more confidence that we haven't fundamentally changed the behavior of `meteor add` or `meteor update` in 0.9.3.
This commit is contained in:
@@ -153,16 +153,19 @@ Tinytest.add(
|
||||
};
|
||||
|
||||
compare("1.0.0", "1.2.0", "<");
|
||||
compare("1.0.0_200", "1.2.0", "<");
|
||||
compare("1.0.0_50", "1.0.1", "<");
|
||||
compare("1.0.0_50", "1.2.0", "<");
|
||||
compare("1.0.0_1", "1.0.0_2", "<");
|
||||
compare("1.0.0_2", "1.0.0_10", "<"); // verify that we compare ~N as numbers, not strings
|
||||
compare("1.0.0", "1.0.0_2", "<");
|
||||
compare("1.123.0_123", "3.0.0_2", "<");
|
||||
compare("1.99.0_99", "3.0.0_2", "<");
|
||||
compare("1.99.0", "2.0.0", "<");
|
||||
compare("1.0.0_5", "1.0.0_2", ">");
|
||||
compare("1.0.0_200", "1.2.0", "<");
|
||||
compare("1.0.0_99", "1.2.0", "<");
|
||||
compare("1.0.0_99", "1.0.1", "<");
|
||||
compare("1.0.0_1", "1.0.0_2", "<");
|
||||
compare("1.0.0", "1.0.0_2", "<");
|
||||
compare("1.123.0_123", "3.0.0_2", "<");
|
||||
compare("1.99.0_99", "3.0.0_2", "<");
|
||||
|
||||
compare("1.0.0_5", "1.0.0_2", ">");
|
||||
compare("1.0.0", "1.0.0", "=");
|
||||
|
||||
@@ -59,7 +59,7 @@ var extractSemverPart = function (versionString) {
|
||||
//
|
||||
// [* XXX!] We don't quite satisfy the uniqueness and comparison properties in
|
||||
// these cases:
|
||||
// 1. If any of the version parts are greater than 250 (pretty unlikely?)
|
||||
// 1. If any of the version parts are greater than 100 (pretty unlikely?)
|
||||
// 2. If we're dealing with a prerelease version, we only look at the
|
||||
// first two characters of each prerelease part. So, "1.0.0-beta" and
|
||||
// "1.0.0-bear" will have the same magnitude.
|
||||
@@ -75,11 +75,11 @@ PV.versionMagnitude = function (versionString) {
|
||||
var version = extractSemverPart(versionString);
|
||||
var v = semver.parse(version.semver);
|
||||
|
||||
return v.major * 250 * 250 * 250 +
|
||||
v.minor * 250 * 250 +
|
||||
v.patch * 250 +
|
||||
version.wrapNum +
|
||||
prereleaseIdentifierToFraction(v.prerelease);
|
||||
return v.major * 100 * 100 +
|
||||
v.minor * 100 +
|
||||
v.patch +
|
||||
version.wrapNum / 100 +
|
||||
prereleaseIdentifierToFraction(v.prerelease) / 100 / 100;
|
||||
};
|
||||
|
||||
// Accepts an array, eg ["rc", 2, 3]. Returns a number in the range
|
||||
|
||||
Reference in New Issue
Block a user