mbarkhau/bumpver

ERROR: Invalid version '' for pattern 'MAJOR.MINOR.PATCH'

j3mdamas opened this issue · 2 comments

Hi,

This is probably just a very small bug, but when using the test function for SemVer and not passing any of the mandatory flags (patch, minor, or major), the error message is different (and does not explain what is wrong, the lack of the mandatory flags) when the input tag is 0.0.0:

$ bumpver test "0.0.0" "MAJOR.MINOR.PATCH" -vv
2023-03-20T15:06:04.911 DEBUG   bumpver.cli       - Logging configured.
2023-03-20T15:06:04.911 INFO    bumpver.cli       - Using pattern MAJOR.MINOR.PATCH
2023-03-20T15:06:04.912 INFO    bumpver.cli       - regex = re.compile(r"""
    (?P<major>[0-9]+)
    \.
    (?P<minor>[0-9]+)
    \.
    (?P<patch>[0-9]+)
""", flags=re.VERBOSE)
2023-03-20T15:06:04.912 ERROR   bumpver.cli       - Invalid version '' for pattern 'MAJOR.MINOR.PATCH'

An example for 0.0.1 (but outputs the same for any other valid SemVer version):

$ bumpver test "0.0.1" "MAJOR.MINOR.PATCH" -vv
2023-03-20T15:06:09.367 DEBUG   bumpver.cli       - Logging configured.
2023-03-20T15:06:09.367 INFO    bumpver.cli       - Using pattern MAJOR.MINOR.PATCH
2023-03-20T15:06:09.367 INFO    bumpver.cli       - regex = re.compile(r"""
    (?P<major>[0-9]+)
    \.
    (?P<minor>[0-9]+)
    \.
    (?P<patch>[0-9]+)
""", flags=re.VERBOSE)
2023-03-20T15:06:09.368 ERROR   bumpver.v2version - Invalid arguments or pattern, version did not change.
2023-03-20T15:06:09.368 WARNING bumpver.cli       - bumpver test [--major/--minor/--patch] required for use with SemVer.

I used bumpver version 2022.1120 in the above example.

A reasonable request. We could either special case SemVer or maybe there is something more general to generate better error messages, I'm not sure.

I'm open to pull requests for this, otherwise, I may find time to work on this in early april.

Thanks for the fix