-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
A way for users to bulk upgrade across incompatible versions #12425
Comments
Below is some background on what we are using to help come up with a design Care AboutsPriorities
Primary use cases:
Secondary use cases are:
Some open questions we had
ContextCurrently,
Version requirement editing is different in that
And as a reminder of the CLI: cargo update -p foo # select a non-ambiguous `foo` and update it
cargo update -p foo@ver # selects a specific `foo` to update
cargo update -p foo --aggressive # also update dependencies
cargo update -p foo --precise <ver> # select a specific version
cargo update --locked # fail if the lockfile will change Note: Some design tools we can consider include
InterjectionThrough this, I realized that the core of my concern with our previous attempts at a single command is that it feels like we are shoehorning new behaviors into
I also realized that my Windows Updates vs Windows Upgrades analogy for |
Proposal:
|
fix(update): Tweak CLI behavior ### What does this PR try to resolve? When looking at `cargo update` for #12425, I noticed that the two flags related to `--package` were not next to it or each other. I figured grouping them like that would make things easier to browse. When looking into that, I noticed that the two flags conflict and figured we'd provide a better error message if we did that through clap. ### How should we test and review this PR? Looking per commit will help show the behavior changes. ### Additional information I wanted to scope this to being simple, non-controversial, low effort, incremental improvements with this change so I did not look into the history of `--aggressive` not requiring `--package` like `--precise` does and figure out if there is any consistency we can be working towards.
This proposal has been up here and on internals for a bit now without any major concerns raised. @rfcbot fcp merge |
Team member @epage has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Having been fairly involved in this discussion via the internals thread, I'm happy to see this move forward in a direction that I wholeheartedly support. @epage thanks for pushing this forward! |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Can |
Yes, we'd update the version requirement, if an incompatible version exists, and then run the normal code. |
When working on cargo-upgrade, I found the meaning of `--aggressive` confusing and named it `--recursive` there. Renaming this in `cargo update` (with a backwards compatible alias) was referenced in rust-lang#12425.
This is probably stating the obvious. But if a dependency is imprecise, current Let's say a dependency is The separation of the tools and the clarity on each one's remit makes this, if not immediately predictable, at least easily understandable. But if this will no longer be the case, then this distinction, or a change from that behavior, should be made clear. For what it's worth, I don't like this behavior, and I'll implement |
FYI on zulip I brought up the idea of a |
Generally, cargo avoids positional arguments. Mostly for the commands that might forward arguments to another command, like `cargo test`. It also allows some flexibility in turning flags into options. For `cargo add` and `cargo remove`, we decided to accept positionals because the motivations didn't seem to apply as much (similar to `cargo install`). This applies the pattern to `cargo update` as well which is in the same category of commands as `cargo add` and `cargo remove`. Switching to a positional for `cargo update` (while keeping `-p` for backwards compatibility) was referenced in rust-lang#12425.
Generally, cargo avoids positional arguments. Mostly for the commands that might forward arguments to another command, like `cargo test`. It also allows some flexibility in turning flags into options. For `cargo add` and `cargo remove`, we decided to accept positionals because the motivations didn't seem to apply as much (similar to `cargo install`). This applies the pattern to `cargo update` as well which is in the same category of commands as `cargo add` and `cargo remove`. As for `--help` formatting, I'm mixed on whether `[SPEC]...` should be at the top like other positionals or should be relegated to "Package selection". I went with the latter mostly to make it easier to visualize the less common choice. Switching to a positional for `cargo update` (while keeping `-p` for backwards compatibility) was referenced in rust-lang#12425.
Generally, cargo avoids positional arguments. Mostly for the commands that might forward arguments to another command, like `cargo test`. It also allows some flexibility in turning flags into options. For `cargo add` and `cargo remove`, we decided to accept positionals because the motivations didn't seem to apply as much (similar to `cargo install`). This applies the pattern to `cargo update` as well which is in the same category of commands as `cargo add` and `cargo remove`. As for `--help` formatting, I'm mixed on whether `[SPEC]...` should be at the top like other positionals or should be relegated to "Package selection". I went with the latter mostly to make it easier to visualize the less common choice. Switching to a positional for `cargo update` (while keeping `-p` for backwards compatibility) was referenced in rust-lang#12425.
When working on cargo-upgrade, I found the meaning of `--aggressive` confusing and named it `--recursive` there. Renaming this in `cargo update` (with a backwards compatible alias) was referenced in rust-lang#12425.
Generally, cargo avoids positional arguments. Mostly for the commands that might forward arguments to another command, like `cargo test`. It also allows some flexibility in turning flags into options. For `cargo add` and `cargo remove`, we decided to accept positionals because the motivations didn't seem to apply as much (similar to `cargo install`). This applies the pattern to `cargo update` as well which is in the same category of commands as `cargo add` and `cargo remove`. As for `--help` formatting, I'm mixed on whether `[SPEC]...` should be at the top like other positionals or should be relegated to "Package selection". I went with the latter mostly to make it easier to visualize the less common choice. Switching to a positional for `cargo update` (while keeping `-p` for backwards compatibility) was referenced in rust-lang#12425.
More `update --breaking` tests Related to #12425 (comment) in #12425.
would it be possible / is it currently planned to also update non-breaking versions in the
i don't know if this is a desired feature, but since |
That is covered in #12425 (comment)
|
For my use case of Quoting myself from #14204 (apparently @epage prefers feedback in this issue instead):
As such it seems I will probably have to port cargo-upgrade from cargo-edit to sparse registry myself at some point. When and if I have time. As |
…te-breaking, r=weihanglo Improved error message when `update --breaking` invalid spec. Improves an error message when trying to do `cargo update --breaking clap@foo`: ``` - [ERROR] expected a version like "1.32" + [ERROR] invalid package ID specification: `clap@foo` + Caused by: + expected a version like "1.32" ``` Related to #12425. Fixes an item [here](#12425 (comment)), as noted [here](#14049 (comment)).
…te-breaking, r=weihanglo Improved error message when `update --breaking` invalid spec. Improves an error message when trying to do `cargo update --breaking clap@foo`: ``` - [ERROR] expected a version like "1.32" + [ERROR] invalid package ID specification: `clap@foo` + Caused by: + expected a version like "1.32" ``` Related to #12425. Fixes an item [here](#12425 (comment)), as noted [here](#14049 (comment)).
Personally I don't know if we took the right approach to pre-releases in #14250 — I left more of a comment on that issue (#14178 (comment)), but my overall proposal is:
This, what I would consider a bug, showed up with Let me know if I'm misguided here / if you'd like me to try to submit a PR! |
Isn't this the last checkbox of #12425 (comment)? |
Should it also upgrade from |
I think all of those should be in scope for |
I would say yes. If you decide to go with a prerelease, it usually means you want the latest thing. Also, I remember having read somewhere that prereleases are incompatible between each other, so |
But what if |
I mean, you're not going to have |
I reckon we should try to stick to semver's rules here (https://semver.org/#semantic-versioning-specification-semver):
|
And would agree with @djc that moving to a higher version is better than taking into account age — though really there should probably be a lint for anyone trying to push a lower prerelease version than is already published (if there isn't already?) |
And just to have this all in the same place, from #14178 (comment):
Perhaps that's better as So this upgrading between pre-releases only happens when all of the pre-releases have that same MAJOR, MINOR, and PATCH versions, and otherwise it looks for a newer stable version to upgrade to? |
Yes, I agree the logic should be:
(Note that even though I'm writing that, that's not what I would like to use. I would like something like #14372. But it could be a separate flag.) |
From what I understand of the current semantics, they are what they should be.
At this time, updating through pre-releases is not a breaking change, so To update pre-releases that use
We need to clarify the semantics for how to handle this case |
@VorpalBlade I just ran into the same issue as you, seems like updating non-breaking versions (#12425 (comment)) is now being tracked here: #10498. |
Problem
A lot of incompatible upgrades have a small enough of breakages that a "upgrade all of my incompatible version requirements" would make it easier to go through this process.
This is currently exposed in the
cargo upgrade
commandProposed Solution
Tasks
cargo update --breaking
#13979cargo update --breaking only-compatible renamed non-semver-operator transitive-dep
--precise <breaking>
-p
more convenient by being positional #12545Deferred
See #12425 (comment)
Previously, https://internals.rust-lang.org/t/feedback-on-cargo-upgrade-to-prepare-it-for-merging/17101/141
Unresolved questions
--breaking
to focus on semver (as this is limited to^
)--incompatible
applies to all version req operators and doesn't have a good short flag (-i
is generally assumed to be "interactive")--major-versions
though we have the issue of "absolute major" (x.0.0
) and "relative major (also0.x.0
,0.0.x
).--major
--latest
because of a "latest" tagNotes
Related
cargo-upgrade
) #10498The text was updated successfully, but these errors were encountered: