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

Add --dry-run option #4

Open
CAD97 opened this issue May 12, 2020 · 6 comments
Open

Add --dry-run option #4

CAD97 opened this issue May 12, 2020 · 6 comments
Labels
feature New feature or request

Comments

@CAD97
Copy link
Contributor

CAD97 commented May 12, 2020

This would be useful for learning how the tool works without accidentally changing remote state. Go through all of the motions of the command, but revert any and all changes and print a list of what actions were taken.

@pksunkara
Copy link
Owner

I agree, unfortunately, it was a bit complex for me to add it as part of the first release.

@pksunkara
Copy link
Owner

The hard part here is git related actions.

@mathstuf
Copy link

I think just reporting "would run git …; further action may depend on its results" is sufficient there as a first pass.

@leighmcculloch
Copy link

Another issue is what to do with crates in the workspace that are dependent on each other. It is not possible to use the official cargo publish --dry-run command on a crate if that crate is dependent on another crate version that isn't yet published.

@leighmcculloch
Copy link

I experimented with adding dry run support to cargo workspaces, and I think I came up with this workflow that works, although it doesn't address that last issue I mentioned above. The change is here: #78.

@pksunkara In terms of git related actions, I made the dry run option disable git pushes. I left the other git operations enabled because it is somewhat blurry where the 'dry run' line should fall on what happens and what doesn't. It is useful for the commit and tag to be created so as to see what would have resulted during a dry run, but it could also be annoying that this happens. However, because those things have their own options it is always possible for someone to turn them off.

@leighmcculloch
Copy link

Note that change #78 doesn't support workspaces where crates are dependent on each other, since cargo publish requires all dependencies to have been published even during a dry run. I didn't see a way to address this at this time.

I think the only way might be to have cargo-workspaces embed a local registry and run a http server for it and have cargo publish to that local registry as a "dry run". This could potentially be an extension made after #78.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants