diff --git a/Project.toml b/Project.toml index 0f9c1693..dcbf2a18 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.3.0" +version = "3.4.0" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/src/main.jl b/src/main.jl index 54314dd6..10f494a1 100644 --- a/src/main.jl +++ b/src/main.jl @@ -39,7 +39,7 @@ Main entry point for the package. - `include_yanked=false`: When set to true, yanked versions will be included when calculating what the latest version of a package is """ function main( - env::AbstractDict=ENV, ci_cfg::CIService=auto_detect_ci_service(; env=env); kwargs... + env::AbstractDict=ENV, ci_cfg::CIService=auto_detect_ci_service(; env=env); strict_version::Bool=false, kwargs... ) options = Options(; kwargs...) @@ -58,7 +58,7 @@ function main( for dep in deps pr = @mock make_pr_for_new_version( - api, repo, dep, options.entry_type, ci_cfg; options, subdir + api, repo, dep, options.entry_type, ci_cfg; strict_version, options, subdir ) if !isnothing(pr) diff --git a/src/utilities/new_versions.jl b/src/utilities/new_versions.jl index a652e692..e593fd9a 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, 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)" @@ -208,13 +209,17 @@ function make_pr_for_new_version( env=ENV, options::Options, subdir::String, + strict_version::Bool=false ) if !continue_with_pr(dep, options.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) + 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 5cc75207..0e5d3b09 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 "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"), + (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"), +] + 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"), ("", "") ]