-
Notifications
You must be signed in to change notification settings - Fork 153
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
fix(upgrade): Implement compatible/incompatible/pinned behavior #804
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is mostly a cleanup to make it easier to detect when we have a new incompatible but it did have a slight behavior change.
On the path to upstreaming into cargo, this is part of an experiment that asks "what if we started from scratch, what would `cargo update` look like?". Besides getting us to think outside the box, I hope that we can deprecate `cargo update` and replace it with `cargo upgrade`. To build up a case to justify the ecosystem churn, we need to get run time with the expected behavior to see how it works. This is disruptive to existing cargo-edit users though. So why move away from the traditional behavior? Reason 1: The new model for `cargo upgrade` is "what if `cargo update` updated the manifest to match the lock file". `cargo update` only deals with compatible upgrades and it would be disruptive to that common workflow to deal with incompatible upgrades. Reason 2: There are several workflows we are trying to cover that involve needing to upgrade only a subset of dependencies. Before, we had been working under the assumption of incompatible-by-default which required ways to opt-out which have been a bit awkward. Compatible-by-default provides a simple way of supporting most documented workflows - Application authors who want the latest features and bug fixes can get it with a simple `cargo upgrade -i` - Users who want to defer breaking changes can do so by leaving off `--incompatible` or having it but using it with `--exclude` - For maintainers who want isolated PRs, so long as someone has done `cargo upgrade`, merged it, and then done `cargo upgrade --incompatible`, they'll get that. The workflows we are underserving still are: - Library authors who want to keep their compatible versions low will need to go through awkwards steps of `cargo upgrade --dry-run` and then re-running with `-p` for each incompatible dependency - Checking for upgrades is easy but checking for only incomptible upgrades will be a pain Our alteratives to these haven't been great though - Provide `--no-compatible` which feels out of place and awkward to tack on - Make the flags `--compatible=<true|false>`, etc which would be cumbersome to specify. We could make them `true` if no value is specified. This makes things feel more consistent but its still cumbersome to have incompatible-only upgrades (`--compatible=false` instead of `--no-compatible`). This would fit in with `--recursive=<true|false>`. - Make `--compatible` the default if no flags are specified but otherwise make the flags additive (`cargo upgrade` would upgade compatible but `cargo upgrade --incompatible` wouldn't and would require `cargo upgrade --incompatible --compatible`). This feels like it'd be too confusing - Make `--compatible` the default but make all flags mutually exclusive. This makes the specifying-a-specific case short but requires running 2-3 times to cover multiple cases. Road humps in the users workflow like this are frustrating.
The advantage of this route - All use cases are covered - No surprises - Users can define aliases to get the behavior they want
This reduces noise in the note column and has the unchanged summary better reflect what would be changed with flags.
With all of the recent changes, we've not re-evaluated what rows are shown or what colors are used for the columns.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is part of an experiment on the path to upstreaming into cargo
that asks "what if we started from scratch, what
would
cargo update
look like?". Besides getting us to think outsidethe box, I hope that we can deprecate
cargo update
and replace it withcargo upgrade
. To build up a case to justify the ecosystem churn, weneed to get run time with the expected behavior to see how it works.
The new behavior is
--incompatible
or--pinned
to upgrade others to incompatible versions--compatible false
to exclusive upgrade incompatible versions when used with another flagThis is disruptive to existing cargo-edit users though. So why
move away from the traditional behavior?
Reason 1: The new model for
cargo upgrade
is "what ifcargo update
updated themanifest to match the lock file".
cargo update
only deals withcompatible upgrades and it would be disruptive to that common workflow
to deal with incompatible upgrades (ie exacerbate ecosystem churn)
Reason 2: There are several workflows we are trying to cover that
involve needing to upgrade only a subset of dependencies. Before, we
had been working under the assumption of incompatible-by-default which
required ways to opt-out which have been a bit awkward.
Compatible-by-default provides a simple way of supporting most documented
workflows
it with a simple
cargo upgrade -i
--incompatible
or having it but using it with--exclude
cargo upgrade
and thencargo upgrade --incompatible
or, if they don't want data races, can docargo upgrade
and thencargo upgrade --incompatible --compatible false
cargo upgrade --incompatible --compatible false
cargo upgrade --locked --incompatible
and checking for only incompatible upgrades iscargo upgrade --locked --incompatible --compatible false
In getting here, we considered several other alternatives, including
--no-compatible
which feels out of place and awkward to tackon
--compatible
the default if no flags are specified butotherwise make the flags additive (
cargo upgrade
would upgadecompatible but
cargo upgrade --incompatible
wouldn't and wouldrequire
cargo upgrade --incompatible --compatible
). This feels likeit'd be too confusing
--compatible
the default but make all flags mutually exclusive.This makes the specifying-a-specific case short but requires running
2-3 times to cover multiple cases. Road humps in the users workflow
like this are frustrating.
Other reasons I went with the current approach
--recursive
cargo check --features
)cargo add
being an exception)Other behavior change
--help
output got some clean up