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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Implement a "Replaced by" relationship #1888
WIP: Implement a "Replaced by" relationship #1888
Changes from all commits
cc32d1f
815e17b
a93d5d5
1215425
3275e62
86eed6a
1b16514
233c885
a3d0192
604518d
d2d2e03
05d8b35
9e2b227
740f806
139a05c
6c17370
9265498
bee216b
f221ccc
fd3fd49
d67cf7b
9b4ed9f
bf170ac
838663d
3b84325
8fc3bbd
955a0bd
33c48a3
c8ab009
e5f932a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the rationale for making a new command for this? From reading #904, it sounded like this would tie into the existing
upgrade
command as needed. If we're confident enough in the replacement mod to put it in the metadata, why would we want to trouble the user with knowing whether it's an upgrade or a replaced_by?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is sufficiently different that users should have to make a distinct choice to replace a mod rather than simply upgrading. We don't want users asking us why they have unknown mods in their list suddenly when they aren't dependencies. Also, the logic is quite distinct and it's way easier to implement as a separate command than increase the complexity of the existing command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points. But if a user just wants to get the latest updates and doesn't particularly care if they're called XYZ or XYZReplaced, I could see it being an irritation to have to run multiple commands, every time.
What about using an optional flag to create a combination command? Something like:
ckan upgrade --all --with-replacements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installed
already returnsDictionary<string, Version>
. Do we really need to make a copy of it? That will presumably cost CPU time. This should work:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why it is like that. I copied the code from the Upgrade command, and that bit is unchangedThe comment on the last change to that code says "remove registry-related getters in KSP class to reduce cyclomatic complexity" - it was by @ayan4m1 in #1828
I note that ayan4m1 didn't introduce this particular
new Dictionary<string, Version>
, but he didn't change it, either. That may have been because his focus was elsewhere and this was simply on necessary adjustment among many, but perhaps he saw some rationale behind making this a copy rather than a reference? Perhaps we don't want changes we make to the registry in the process to mess up our processing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough; it would make sense to reserve this for a separate project that addresses all commands at once, if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently if I try to replace mods that aren't replaceable...
... there's no error message, it just says that it finished. Similarly, I can even give it completely invalid mod names:
If I'm trying to replace a mod that actually is replaceable but I mistype the name or capitalize it wrong, I might think I have just performed the replacement when in fact I have done nothing. I think it would be good to raise errors here if mods the user specified are invalid or not replaceable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those sort of issues are logInfos. By default, the CLI only reports actual actions it takes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the CLI reports errors when mods are missing: