Skip to content
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

Provide ability to rollback a cargo update #2065

Closed
huonw opened this issue Oct 20, 2015 · 8 comments
Closed

Provide ability to rollback a cargo update #2065

huonw opened this issue Oct 20, 2015 · 8 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-update S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. S-propose-close Status: A team member has nominated this for closing, pending further input from the team

Comments

@huonw
Copy link
Member

huonw commented Oct 20, 2015

It's possible to a cargo update to fail/be suboptimal, e.g. #2064 or pick up a broken version of package, so it would be nice to be able to reset to a known working state (and then be more precise about the updates). Something like cargo update --reset or cargo update --rollback.

This would presumably have to store a copy of the old Cargo.lock, in /path/to/project/.cargo or with the global database. It would also be mainly focusing on library development, since theoretically all binaries will be version-controlling their Cargo.locks (although I'm sure not all will).

Thoughts?

@alexcrichton
Copy link
Member

I've always thought this was basically just git checkout Cargo.lock along the lines of letting VCS take care of this kind of rollback instead of having support in Cargo itself. I can see, however, where this doesn't quite cut it in all situations.

@huonw
Copy link
Member Author

huonw commented Feb 29, 2016

Checking out doesn't work for libraries, since lock files are recommended to not be version controlled for them, and most people follow this advice (e.g. one is working on a lib, runs cargo update to pull in some new version, and accidentally gets stuck in a broken state, with no easy way to get back and continue working).

@anguslees
Copy link

This could also be as simple as rotating the existing Cargo.lock to some type of versioned/dated in-place backup file. Anything that allows the user to go "oops; mv Cargo.$backup Cargo.lock; profit"

@carols10cents carols10cents added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-update labels Sep 10, 2017
@weihanglo weihanglo added the S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. label May 14, 2023
@weihanglo
Copy link
Member

Not if we still want this feature, since with #6371 we have cargo update --dry-run since Rust 1.33. It can also be easily done with an aid from version control systems. I'd rather avoid an extra layer of complexity.

Going to solicit feedback for a while if there are some situations cannot apply aforementioned workarounds. If not, I'll close this as "not planned"

@epage
Copy link
Contributor

epage commented May 24, 2023

#5221 is about supporting resolving to a specific date which would be one way of resolving the use case in this issue.

@epage
Copy link
Contributor

epage commented Sep 19, 2023

btw #8728 is resolved and we now recommend checking in lockfiles

@epage epage added the S-propose-close Status: A team member has nominated this for closing, pending further input from the team label Sep 28, 2023
@epage
Copy link
Contributor

epage commented Sep 28, 2023

I'm proposing we close this.

With #8728 resolved, the main use case for this issue is resolved. #6371 addresses more. We also have #5221 as a potential alternative for reconstructing old lockfiles.

@weihanglo
Copy link
Member

Make sense. Closing.

If you have a reason to keep this open, please comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-update S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. S-propose-close Status: A team member has nominated this for closing, pending further input from the team
Projects
None yet
Development

No branches or pull requests

6 participants