mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
fix gitlab.com #5: better bump warning for semver
This commit is contained in:
parent
a3d1a559b8
commit
e743359881
3 changed files with 75 additions and 8 deletions
|
|
@ -354,7 +354,12 @@ def bump(
|
|||
patch=patch,
|
||||
)
|
||||
if new_version is None:
|
||||
log.error(f"Invalid version '{old_version}' and/or pattern '{cfg.version_pattern}'.")
|
||||
is_semver = "{semver}" in cfg.version_pattern
|
||||
has_semver_inc = major or minor or patch
|
||||
if is_semver and not has_semver_inc:
|
||||
log.warning("bump --major/--minor/--patch required when using semver.")
|
||||
else:
|
||||
log.error(f"Invalid version '{old_version}' and/or pattern '{cfg.version_pattern}'.")
|
||||
sys.exit(1)
|
||||
|
||||
log.info(f"Old Version: {old_version}")
|
||||
|
|
|
|||
|
|
@ -472,6 +472,9 @@ def write_content(ctx: ProjectContext) -> None:
|
|||
fh: typ.IO[str]
|
||||
|
||||
cfg_content = default_config(ctx)
|
||||
if ctx.config_filepath.exists():
|
||||
cfg_content = "\n" + cfg_content
|
||||
|
||||
with ctx.config_filepath.open(mode="at", encoding="utf-8") as fh:
|
||||
fh.write(cfg_content)
|
||||
print(f"Updated {ctx.config_filepath}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue