diff --git a/CHANGELOG.md b/CHANGELOG.md index 556262d..ea1b8bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,12 @@ ## BumpVer 2023.1121 - Fix [#200][gh_i200]: Fix compatability with packaging 23.0. +- Fix [#203][gh_i203]: Add dev to the list of valid release tags [gh_i200]: https://github.com/mbarkhau/bumpver/issues/200 +[gh_i203]: https://github.com/mbarkhau/bumpver/issues/203 + +Thank you [Sharon Yogev](https://github.com/sharonyogev) for your contribution. ## BumpVer 2022.1120 diff --git a/README.md b/README.md index fc8672c..ef32754 100644 --- a/README.md +++ b/README.md @@ -609,7 +609,7 @@ Options: --tag-num Increment release tag number (rc1, rc2, rc3..). -t, --tag Override release tag of current_version. Valid - options are: alpha, beta, rc, post, final. + options are: alpha, beta, dev, rc, post, final. -p, --patch Increment PATCH component. -m, --minor Increment MINOR component. --major Increment MAJOR component. @@ -644,22 +644,22 @@ final [url_calver_org_scheme]: https://calver.org/#scheme -| part | range / example(s) | info | -|------------|---------------------------|---------------------------------------------| -| `MAJOR` | 0..9, 10..99, 100.. | `bumpver update --major` | -| `MINOR` | 0..9, 10..99, 100.. | `bumpver update --minor` | -| `PATCH` | 0..9, 10..99, 100.. | `bumpver update --patch` | -| `TAG` | alpha, beta, rc, post | `--tag=` | -| `PYTAG` | a, b, rc, post | `--tag=` | -| `NUM` | 0, 1, 2... | `-r/--tag-num` | -| `YYYY` | 2019, 2020... | Full year, based on `strftime('%Y')` | -| `YY` | 18, 19..99, 0, 1 | Short year, based on `int(strftime('%y'))` | -| `MM` | 9, 10, 11, 12 | Month, based on `int(strftime('%m'))` | -| `DD` | 1, 2, 3..31 | Day, based on `int(strftime('%d'))` | -| `BUILD` | 1001, 1002 .. 1999, 22000 | build number (maintains lexical order) | -| `INC0` | 0, 1, 2... | 0-based auto incrementing number | -| `INC1` | 1, 2... | 1-based auto incrementing number | -| `PYTAGNUM` | a0, a1, rc0, ... | `PYTAG` + `NUM` (no white-space in between) | +| part | range / example(s) | info | +|------------|----------------------------|---------------------------------------------| +| `MAJOR` | 0..9, 10..99, 100.. | `bumpver update --major` | +| `MINOR` | 0..9, 10..99, 100.. | `bumpver update --minor` | +| `PATCH` | 0..9, 10..99, 100.. | `bumpver update --patch` | +| `TAG` | dev, alpha, beta, rc, post | `--tag=` | +| `PYTAG` | a, b, rc, post | `--tag=` | +| `NUM` | 0, 1, 2... | `-r/--tag-num` | +| `YYYY` | 2019, 2020... | Full year, based on `strftime('%Y')` | +| `YY` | 18, 19..99, 0, 1 | Short year, based on `int(strftime('%y'))` | +| `MM` | 9, 10, 11, 12 | Month, based on `int(strftime('%m'))` | +| `DD` | 1, 2, 3..31 | Day, based on `int(strftime('%d'))` | +| `BUILD` | 1001, 1002 .. 1999, 22000 | build number (maintains lexical order) | +| `INC0` | 0, 1, 2... | 0-based auto incrementing number | +| `INC1` | 1, 2... | 1-based auto incrementing number | +| `PYTAGNUM` | a0, a1, rc0, ... | `PYTAG` + `NUM` (no white-space in between) | The following are also available, but you should review the [Normalization Caveats](#normalization-caveats) before you decide to use them. diff --git a/src/bumpver/cli.py b/src/bumpver/cli.py index 803864f..7870220 100755 --- a/src/bumpver/cli.py +++ b/src/bumpver/cli.py @@ -68,7 +68,7 @@ def _configure_logging(verbose: int = 0) -> None: logger.debug("Logging configured.") -VALID_RELEASE_TAG_VALUES = ("alpha", "beta", "rc", "post", "final") +VALID_RELEASE_TAG_VALUES = ("alpha", "beta", "dev", "rc", "post", "final") _current_date = dt.date.today().isoformat() diff --git a/src/bumpver/v2patterns.py b/src/bumpver/v2patterns.py index 4758440..ee9008f 100644 --- a/src/bumpver/v2patterns.py +++ b/src/bumpver/v2patterns.py @@ -82,8 +82,8 @@ PART_PATTERNS = collections.OrderedDict( ('PATCH' , r"[0-9]+"), ('BUILD' , r"[0-9]+"), ('BLD' , r"[1-9][0-9]*"), - ('TAG' , r"preview|final|alpha|beta|post|rc"), - ('PYTAG' , r"post|rc|a|b"), + ('TAG' , r"preview|final|dev|alpha|beta|post|rc"), + ('PYTAG' , r"dev|post|rc|a|b"), ('GITHASH', r"\.[0-9]+\+.*"), ('NUM' , r"[0-9]+"), ('INC0' , r"[0-9]+"), diff --git a/src/bumpver/version.py b/src/bumpver/version.py index 0eff7ac..01e9ca6 100644 --- a/src/bumpver/version.py +++ b/src/bumpver/version.py @@ -16,7 +16,7 @@ def parse_version(version: str) -> typ.Any: import pkg_resources return pkg_resources.parse_version(version) - except (ImportError, pkg_resources.extern.packaging.version.InvalidVersion): + except (ImportError, ValueError): import looseversion return looseversion.LooseVersion(version) diff --git a/test/test_cli.py b/test/test_cli.py index 5f96a59..bcccb21 100644 --- a/test/test_cli.py +++ b/test/test_cli.py @@ -258,6 +258,15 @@ def test_incr_tag(runner): assert f"Version: {new_version}\n" in result.output +def test_dev_tag(runner): + old_version = "0.1.0" + new_version = "0.1.1dev0" + + result = runner.invoke(cli.cli, ['test', "-vv", old_version, SEMVER, "--patch", "--tag", "dev"]) + assert result.exit_code == 0 + assert f"Version: {new_version}\n" in result.output + + def test_incr_tag_num(runner): old_version = "0.1.0b0" new_version = "0.1.0b1"