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

feat: MVP for cargo set-version #482

Merged
merged 1 commit into from
Sep 11, 2021
Merged

feat: MVP for cargo set-version #482

merged 1 commit into from
Sep 11, 2021

Conversation

epage
Copy link
Collaborator

@epage epage commented Aug 25, 2021

The name is not version because cargo version reports cargo's
version number.

The UI and implementation are lifted from cargo-release

Differences with cargo-release:

  • Relative version changes is behind --bump rather than overloading
    the positional argument
    • Motivation: It didn't jive with set- in the name
    • Side benefit: Better error reporting

Differences with #414:

  • --bump <level> vs --<level>
    • --bump scales better
  • This PR supports --metadata, --exclude

Required future work

  • Update workspace dependents when modifying versions

Possible future work

  • --at-least flag to ignore downgrades, rather than error
  • A flag to upgrade everything to the highest requested version (keep
    things in lockstep with --bump patch)
  • A flag to upgrade min requirements on dependents (rather than just
    updating if semver is broken)
  • --pre flag so you can do --bump major --pre alpha (even 1.0 --pre alpha since I always forget that syntax)

Closes #338

@epage epage force-pushed the version branch 4 times, most recently from 11020d5 to 40aa520 Compare August 26, 2021 14:29
@epage epage force-pushed the version branch 2 times, most recently from b7d3295 to db3cf69 Compare September 9, 2021 19:33
@epage
Copy link
Collaborator Author

epage commented Sep 9, 2021

@ordian whats the path forward for this?

I'm holding off on #480 because it will lead to conflicts with this

@ordian
Copy link
Collaborator

ordian commented Sep 9, 2021

Sorry for the delay, I'll take a look this week.

@epage
Copy link
Collaborator Author

epage commented Sep 9, 2021

Thanks!

Copy link
Collaborator

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks good.

Naming bikeshed:
what do you think of using cargo bump instead of cargo set-version? E.g. cargo bump 1.0.0 or cargo bump minor.

README.md Outdated
release, rc, beta, alpha]
--exclude <exclude>... Crates to exclude and not modify
--manifest-path <path> Path to the manifest to upgrade
-m, --metadata <metadata> Version metadata
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that what goes after + https://docs.rs/semver/1.0.4/semver/struct.BuildMetadata.html
would be nice to provide an example

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I gave an example of a use case and in the README pointed to that doc since it does such a good job describing it and how one might use it. Figure it'd be better to link than having to maintain our own copy.

@@ -43,6 +43,11 @@ name = "cargo-upgrade"
path = "src/bin/upgrade/main.rs"
required-features = ["upgrade"]

[[bin]]
name = "cargo-set-version"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think of using cargo bump instead of cargo set-version? E.g. cargo bump 1.0.0 or cargo bump minor.

I did bring up that the current name is what drove me to not overload the version field with relative bumps but to push that out to --bump. The side benefit is error reporting is more complicated when mixing fields.

Personally, I have no real preference within the scope of cargo-edit. I do wonder what would be the more appropriate name if we upstream this into cargo. I would suspect a more explicit name (ie has version in it).

I thought I'd look around for other tools

The name is not `version` because `cargo version` reports cargo's
version number.

The UI and implementation is lifted from `cargo-release`

Differences with `cargo-release`:
- Relative version changes is behind `--bump` rather than overloading
  the positional argument
  - Motivation: It didn't jive with `set-` in the name
  - Side benefit: Better error reporting

Differences with killercup#414:
- `--bump <level>` vs `--<level>`
  - `--bump` scales better
- This PR supports `--metadata`, `--exclude`

Required future work
- Update workspace dependents when modifying versions

Possible future work
- `--at-least` flag to ignore downgrades, rather than error
- A flag to upgrade everything to the highest requested version (keep
  things in lockstep with `--bump patch`)
- A flag to upgrade min requirements on dependents (rather than just
  updating if semver is broken)
- `--pre` flag so you can do `--bump major --pre alpha` (even `1.0 --pre
  alpha` since I always forget that syntax)
@ordian ordian merged commit 8dbc81f into killercup:master Sep 11, 2021
@ordian ordian mentioned this pull request Sep 11, 2021
@epage epage deleted the version branch September 22, 2021 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support modifying the current package's version (version key in Cargo.toml)
2 participants