Skip to content

Commit

Permalink
cargo: Change prerelease versions to end in ".1-pre" instead of ".0"
Browse files Browse the repository at this point in the history
So, the prerelease version is "0.9.1-pre" instead of "0.9.0".

The main goal is to make it easier to tell from "jj version" output whether it
describes a released version or a prerelease.

According to https://semver.org/#spec-item-9, if taken as a semver, this would
be ordered after "v0.9.0" and before "v0.9.1" (if we need to have a patch
release). If "v0.9.1" was released, we could move on to "v0.9.2-pre".

Cargo docs imply that they follow this spec closely:
https://doc.rust-lang.org/cargo/reference/resolver.html#semver-compatibility

### Weirder consequences

"v0.9.1-pre.1" would follow "v0.9.1-pre" if we wanted to publish two
such versions to crate.io for some reason (I don't suggest we do this).

In theory, these are sorted alphabitically, so `v0.9.1-beta < v0.9.1-pre <
v0.9.1-rc1`. This is confusing, so we should never have `.1-alpha` or `.1-beta`
(nor probably `.1-rc1`) versions. I propose that if we ever have alpha or beta
versions, they should always be `.0` versions.
  • Loading branch information
ilyagr committed Sep 15, 2023
1 parent 2177dc0 commit f883a24
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolver = "2"
members = ["cli", "lib", "lib/testutils", "lib/gen-protos"]

[workspace.package]
version = "0.9.0"
version = "0.9.1-pre"
license = "Apache-2.0"
rust-version = "1.71" # NOTE: remember to update CI, contributing.md, changelog.md, and flake.nix
edition = "2021"
Expand Down Expand Up @@ -94,7 +94,7 @@ zstd = "0.12.4"
# put all inter-workspace libraries, i.e. those that use 'path = ...' here in
# their own (alphabetically sorted) block

jj-lib = { path = "lib", version = "0.9.0" }
jj-lib = { path = "lib", version = "0.9.1-pre" }
testutils = { path = "lib/testutils" }

[profile.release]
Expand Down
3 changes: 2 additions & 1 deletion cli/tests/test_global_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ fn test_no_subcommand() {
insta::assert_snapshot!(stdout.lines().next().unwrap(), @"Jujutsu (An experimental VCS)");

let stdout = test_env.jj_cmd_success(test_env.env_root(), &["--version"]);
let sanitized = stdout.replace(|c: char| c.is_ascii_hexdigit(), "?");
let sanitized = stdout.replace("-pre", "");
let sanitized = sanitized.replace(|c: char| c.is_ascii_hexdigit(), "?");
assert!(
sanitized == "jj ?.?.?\n"
|| sanitized == "jj ?.?.?-????????????????????????????????????????\n",
Expand Down

0 comments on commit f883a24

Please sign in to comment.