-
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
Add '--to-lockfile' flag to cargo-upgrade #337
Conversation
I saw issue 297 whilst I was working on #336, so had a go at implementing it. |
273d06b
to
a769f8a
Compare
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.
Thanks again for the PR.
I've left some suggestions and questions and a rebase is needed as well.
tempdir = "0.3.7" | ||
|
||
[build-dependencies] | ||
serde = { version = "1.0", git= "https://github.com/serde-rs/serde.git" } |
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 feel a bit uneasy with all the dependencies here, why is it not enough to have the same dependencies as in tests/fixtures/workspace/one/Cargo.toml
?
The local lock file must be present and up to date if
this flag is passed.
Does this mean CI will fail each time a new version is released (or git commit is pushed)?
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 used cargo's terminology here: a lockfile is up-to-date if it satisfies the Cargo.toml, not if all the dependencies are at the most recent semver compatible version. See docstring for --locked
at https://doc.rust-lang.org/cargo/commands/cargo-metadata.html.
It's a little confusing, but I thought it better to be consistent with cargo. WDYT?
The network isn't accessed when the --to-lockfile
flag is passed, so CI won't fail. I've simplified the test as you suggested, and deliberately added a lockfile with an older version of rand
to demonstrate.
src/bin/upgrade/main.rs
Outdated
|
||
If the '--to-lockfile' flag is supplied, all dependencies will be upraged to the currently locked | ||
version as recorded in the local lock file. The local lock file must be present and up to date if | ||
this flag is passed." |
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.
could you clarify in the docs what you mean by MUST
, e.g. will it result in an error, how does it work with the offline
mode, etc
@tofay merge conflicts needs to be resolved as well, let me know when the PR is ready |
When this flag is present, all dependencies in 'Cargo.toml' are upgraded to the locked version as recorded in 'Cargo.lock'. Multiple manifests in a workspace may request the same dependency at different versions. The version of each dependency is updated to the corresponding semver compatible version in the lockfile.
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.
Thank you!
Co-Authored-By: Andronik Ordian <[email protected]>
bors r+ |
337: Add '--to-lockfile' flag to cargo-upgrade r=ordian a=tofay When this flag is present, all dependencies in 'Cargo.toml' are upgraded to the locked version as recorded in 'Cargo.lock'. Fixes #297 Co-authored-by: Tom Fay <[email protected]> Co-authored-by: Tom Fay <[email protected]>
Thanks for the quick turnaround! |
I only saw this after the release, so sorry for the late feedback, but shouldn't this option be called from-lockfile? to-lockfile to me implies writing the lockfile. |
Yeah I get how you can read |
When this flag is present, all dependencies in 'Cargo.toml'
are upgraded to the locked version as recorded in 'Cargo.lock'.
Fixes #297