From f883a24da31a95c31e69e6adad34b2c9eb12e1af Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Thu, 14 Sep 2023 20:53:47 -0700 Subject: [PATCH] cargo: Change prerelease versions to end in ".1-pre" instead of ".0" 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. --- Cargo.lock | 8 ++++---- Cargo.toml | 4 ++-- cli/tests/test_global_opts.rs | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 28f9ba8798..fd91d16eab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -791,7 +791,7 @@ dependencies = [ [[package]] name = "gen-protos" -version = "0.9.0" +version = "0.9.1-pre" dependencies = [ "prost-build", ] @@ -1013,7 +1013,7 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jj-cli" -version = "0.9.0" +version = "0.9.1-pre" dependencies = [ "anyhow", "assert_cmd", @@ -1060,7 +1060,7 @@ dependencies = [ [[package]] name = "jj-lib" -version = "0.9.0" +version = "0.9.1-pre" dependencies = [ "assert_matches", "backoff", @@ -2130,7 +2130,7 @@ dependencies = [ [[package]] name = "testutils" -version = "0.9.0" +version = "0.9.1-pre" dependencies = [ "config", "git2", diff --git a/Cargo.toml b/Cargo.toml index 990838e660..eed1577b69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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] diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index 853f66110c..d91b1850f1 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -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",