inc BUILD by +1000 if < 1000

This commit is contained in:
Manuel Barkhau 2020-09-17 23:46:30 +00:00
parent 5940fdbc40
commit f11c8c89f8
2 changed files with 7 additions and 1 deletions

View file

@ -6,6 +6,7 @@
- New gitlab #7: New style patterns, to be in line with CalVer.org
- Better support for week numbering.
- Better support for optional parts.
- New: Start `BUILD` parts at `1000` to avoid leading zero truncation.
- New gitlab #10: `--pin-date` to keep date parts unchanged, and only increment non-date parts.
- Fix gitlab #8: Push tags only pushed tags, not actual commit.
- Fix gitlab #9: Make commit message configurable.

View file

@ -486,7 +486,12 @@ def incr(
else:
logger.warning(f"Version appears to be from the future '{old_version}'")
cur_vinfo = cur_vinfo._replace(bid=lexid.incr(cur_vinfo.bid))
_bid = cur_vinfo.bid
if int(_bid) < 1000:
# prevent truncation of leading zeros
_bid = str(int(_bid) + 1000)
cur_vinfo = cur_vinfo._replace(bid=lexid.incr(_bid))
if major:
cur_vinfo = cur_vinfo._replace(major=cur_vinfo.major + 1, minor=0, patch=0)