Allow replacement by conflicting modules #2695
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
If a module conflicts with its
replaced_by
module, clicking the Replace checkbox reports the conflict and blocks installation in GUI as if we were going to install both of them:Noted as part of KSP-CKAN/NetKAN#7027.
Cause
This call throws because it tries to resolve relationships with both conflicting modules installed:
CKAN/GUI/MainModList.cs
Lines 689 to 702 in 6b4cd14
That
null
value was set in #2579, and is the parameter for modules that will be removed; previously we passedmodules_to_remove
, which caused a different exception to be thrown if you removed a module that other modules depend on.Changes
Now the reverse dependency logic happens first, and adds the reverse dependencies to
modules_to_remove
. This then allows us to passmodules_to_remove
to theRelationshipResolver
of the provides loop, since removing the reverse dependencies will prevent an inconsistency from being created.modules_to_remove
is then also passed to the finalRelationshipResolver
which previously recalculated it independently based on the change set, to save a few extra operations.