From 5d16ee946780cee31cfbfc974c32c08188760e98 Mon Sep 17 00:00:00 2001 From: Venkateshprasad <32921645+ven-k@users.noreply.github.com> Date: Mon, 18 Apr 2022 15:53:41 +0530 Subject: [PATCH 1/4] Allow `strict_version` entries --- src/main.jl | 2 ++ src/utilities/new_versions.jl | 6 ++++-- test/utilities/new_versions.jl | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main.jl b/src/main.jl index 180b543d..446400df 100644 --- a/src/main.jl +++ b/src/main.jl @@ -57,6 +57,7 @@ function main( unsub_from_prs=false, cc_user=false, bump_version=false, + strict_version::Bool=false ) generated_prs = Vector{Union{GitHub.PullRequest,GitLab.MergeRequest}}() @@ -93,6 +94,7 @@ function main( unsub_from_prs=unsub_from_prs, cc_user=cc_user, bump_version=bump_version, + strict_version=strict_version ) if !isnothing(pr) diff --git a/src/utilities/new_versions.jl b/src/utilities/new_versions.jl index 958e878d..d3fd1e92 100644 --- a/src/utilities/new_versions.jl +++ b/src/utilities/new_versions.jl @@ -28,7 +28,8 @@ function new_compat_entry(::EntryType, old_compat::Nothing, new_compat::Abstract return "$(strip(new_compat))" end -function compat_version_number(ver::VersionNumber) +function compat_version_number(ver::VersionNumber, strict_version::Bool=false) + strict_version && return "= $(ver.major).$(ver.minor).$(ver.patch)" (ver.major > 0) && return "$(ver.major)" (ver.minor > 0) && return "0.$(ver.minor)" @@ -213,13 +214,14 @@ function make_pr_for_new_version( unsub_from_prs=false, cc_user=false, bump_version=false, + strict_version::Bool=false ) if !continue_with_pr(dep, bump_compat_containing_equality_specifier) return nothing end # Get new compat entry version, pr title, and pr body text - compat_entry_for_latest_version = compat_version_number(dep.latest_version) + compat_entry_for_latest_version = compat_version_number(dep.latest_version, strict_version) brand_new_compat = new_compat_entry( entry_type, dep.version_verbatim, compat_entry_for_latest_version ) diff --git a/test/utilities/new_versions.jl b/test/utilities/new_versions.jl index d4bb0d93..5faa3e51 100644 --- a/test/utilities/new_versions.jl +++ b/test/utilities/new_versions.jl @@ -79,6 +79,19 @@ end @test CompatHelper.compat_version_number(vn) == expected end +@testset "compat_version_number -- $(vn)" for (vn, expected) in [ + (VersionNumber("1.0.0"), "= 1.0.0"), + (VersionNumber("1.1.1"), "= 1.1.1"), + (VersionNumber("1.1.0"), "= 1.1.0"), + (VersionNumber("0.1.0"), "= 0.1.0"), + (VersionNumber("0.1.1"), "= 0.1.1"), + (VersionNumber("0.0.1"), "= 0.0.1"), + (VersionNumber("0.0.0"), "= 0.0.0"), +] + strict_version=true + @test CompatHelper.compat_version_number(vn, strict_version) == expected +end +#= @testset "subdir_string -- $(subdir)" for (subdir, expected) in [ ("foobar", "foobar"), ("foo/bar", "bar"), ("1", "1"), ("", "") ] From 779bfb657742d36fb62f6e2e6c6537fcc8e3386d Mon Sep 17 00:00:00 2001 From: Venkateshprasad <32921645+ven-k@users.noreply.github.com> Date: Mon, 18 Apr 2022 17:48:38 +0530 Subject: [PATCH 2/4] Bump version to 3.2.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index e09acf75..6888822c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CompatHelper" uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" authors = ["Dilum Aluthge", "Brown Center for Biomedical Informatics", "contributors"] -version = "3.1.0" +version = "3.2.0" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" From 0db18821b01e487db9593a56e7fd457470e3d1c6 Mon Sep 17 00:00:00 2001 From: Venkateshprasad <32921645+ven-k@users.noreply.github.com> Date: Mon, 18 Apr 2022 18:25:11 +0530 Subject: [PATCH 3/4] If the entry has "=" then make a strict-version update - bump_compat_containing_equality_specifier and strict_version should be true --- src/utilities/new_versions.jl | 9 ++++++--- test/utilities/new_versions.jl | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/utilities/new_versions.jl b/src/utilities/new_versions.jl index d3fd1e92..cfe43bea 100644 --- a/src/utilities/new_versions.jl +++ b/src/utilities/new_versions.jl @@ -28,8 +28,8 @@ function new_compat_entry(::EntryType, old_compat::Nothing, new_compat::Abstract return "$(strip(new_compat))" end -function compat_version_number(ver::VersionNumber, strict_version::Bool=false) - strict_version && return "= $(ver.major).$(ver.minor).$(ver.patch)" +function compat_version_number(ver::VersionNumber, handle_equality_in_entries::Bool=false) + handle_equality_in_entries && return "= $(ver.major).$(ver.minor).$(ver.patch)" (ver.major > 0) && return "$(ver.major)" (ver.minor > 0) && return "0.$(ver.minor)" @@ -221,7 +221,10 @@ function make_pr_for_new_version( end # Get new compat entry version, pr title, and pr body text - compat_entry_for_latest_version = compat_version_number(dep.latest_version, strict_version) + handle_equality_in_entries = skip_equality_specifiers( + bump_compat_containing_equality_specifier, dep.version_verbatim + ) && strict_version + compat_entry_for_latest_version = compat_version_number(dep.latest_version, handle_equality_in_entries) brand_new_compat = new_compat_entry( entry_type, dep.version_verbatim, compat_entry_for_latest_version ) diff --git a/test/utilities/new_versions.jl b/test/utilities/new_versions.jl index 5faa3e51..26292932 100644 --- a/test/utilities/new_versions.jl +++ b/test/utilities/new_versions.jl @@ -79,7 +79,7 @@ end @test CompatHelper.compat_version_number(vn) == expected end -@testset "compat_version_number -- $(vn)" for (vn, expected) in [ +@testset "Strict compat_version_number -- $(vn)" for (vn, expected) in [ (VersionNumber("1.0.0"), "= 1.0.0"), (VersionNumber("1.1.1"), "= 1.1.1"), (VersionNumber("1.1.0"), "= 1.1.0"), @@ -88,8 +88,8 @@ end (VersionNumber("0.0.1"), "= 0.0.1"), (VersionNumber("0.0.0"), "= 0.0.0"), ] - strict_version=true - @test CompatHelper.compat_version_number(vn, strict_version) == expected + handle_equality_in_entries=true + @test CompatHelper.compat_version_number(vn, handle_equality_in_entries) == expected end #= @testset "subdir_string -- $(subdir)" for (subdir, expected) in [ From 47be28c82d38bc09a3aca81ceeda5e413c130099 Mon Sep 17 00:00:00 2001 From: Venkateshprasad <32921645+ven-k@users.noreply.github.com> Date: Mon, 18 Apr 2022 18:29:31 +0530 Subject: [PATCH 4/4] oops, uncomment all tests --- test/utilities/new_versions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utilities/new_versions.jl b/test/utilities/new_versions.jl index 26292932..51dabc36 100644 --- a/test/utilities/new_versions.jl +++ b/test/utilities/new_versions.jl @@ -91,7 +91,7 @@ end handle_equality_in_entries=true @test CompatHelper.compat_version_number(vn, handle_equality_in_entries) == expected end -#= + @testset "subdir_string -- $(subdir)" for (subdir, expected) in [ ("foobar", "foobar"), ("foo/bar", "bar"), ("1", "1"), ("", "") ]