Skip to content

Adds zero in text files, commit message/tag is fine #182

@luckydonald

Description

@luckydonald

For reproduction the repo luckydonald/pytgbot can be can be checked out at commit 2b35b5901df9d0aa6335d65bfca3dccf3477e8c9.

The config is quite easy,

[bumpversion]
current_version = 5.0.0
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\.(?P<internal>\d+))?)?
serialize =
  	{major}.{minor}.{patch}.{internal}
	{major}.{minor}.{patch}
	{major}.{minor}

[bumpversion:file:pytgbot/__init__.py]

[bumpversion:file:setup.py]

[bumpversion:file:README.md]

If I now run

$ bump2version internal

I'll end up with diffs like

-   name='pytgbot', version="5.0.0",
+   name='pytgbot', version="5.0.0.1.0",

For some reason it adds an unneeded .0 at the end, which it shouldn't.

Funnily enough, the version in the commit message, the .bumpversion file and the tag is correctly 5.0.0.1.

Why would a few of those do completely different things?

I see no reason how it can get that wrong:

>>> old_version = '5.0.0'  # via config file
>>> new_version = '5.0.0.1'  # git message shows it is able to calculate that properly

>>> input = "version=\"5.0.0\""
>>> output = input.replace(old_version, new_version)  # replace 5.0.0 with 5.0.0.1

>>> output
'version="5.0.0.1"'
# now how would that say "5.0.0.1.0"?!?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions