“meteor update” can update non-root dependencies

Previously, “meteor update foo” meant “ignore .meteor/versions for foo”,
which would upgrade if “foo” was a root dependency, and downgrade if foo
was only a transitive dependency.

Now, we make sure to try to upgrade foo even if it is not a root
dependency.

See #3282.
This commit is contained in:
David Greenspan
2015-01-13 09:30:57 -08:00
parent 8339d5e799
commit 4f473ff2d2
2 changed files with 4 additions and 5 deletions

View File

@@ -188,7 +188,7 @@ var getCostFunction = function (resolver, options) {
});
return {
costFunction: function (state, options) {
costFunction: function (state) {
options = options || {};
// very major, major, medium, minor costs
// XXX maybe these can be calculated lazily?
@@ -228,8 +228,7 @@ var getCostFunction = function (resolver, options) {
PV.versionMagnitude(_.last(resolver.unitsVersions[uv.name]).version) -
PV.versionMagnitude(uv.version);
if (isRootDep[uv.name]) {
// root dependency
if (isRootDep[uv.name] || _.has(options.upgrade, uv.name)) {
// preferably latest
cost[MEDIUM] += latestDistance;
} else {
@@ -246,7 +245,7 @@ var getCostFunction = function (resolver, options) {
return cost;
},
estimateCostFunction: function (state, options) {
estimateCostFunction: function (state) {
options = options || {};
var cost = [0, 0, 0, 0];

View File

@@ -77,7 +77,7 @@ ConstraintSolver.Resolver.prototype.getConstraint =
};
// options: Object:
// - costFunction: function (state, options) - given a state evaluates its cost
// - costFunction: function (state) - given a state evaluates its cost
// - estimateCostFunction: function (state) - given a state, evaluates the
// estimated cost of the best path from state to a final state
// - combineCostFunction: function (cost, cost) - given two costs (obtained by