peritus / bumpversion

Version-bump your software with a single command
https://pypi.python.org/pypi/bumpversion
MIT License
1.5k stars 148 forks source link

Documentation for `replace` option is wrong #147

Open itamarst opened 8 years ago

itamarst commented 8 years ago

The example given in docs is:

[bumpversion:file:requirements.txt]
search = MyProject=={current_version}
replace = MyProject=={new_version}

However that will result in a line MyProject==MyProject==1.2.3.

bac commented 7 years ago

I agree. In setup.py I have

VERSION = '0.1.74'

After some trial-and-error I got the following .bumpversion.cfg stanza to work. The documentation was misleading.

[bumpversion:file:setup.py]
search = VERSION \= '{current_version}'
replace = {new_version}
gtback commented 7 years ago

As a counterexample, this works as expected for me (global settings, not for a single file):

[bumpversion]
...
search = MYPROJECT_VERSION = '{current_version}'
replace = MYPROJECT_VERSION = '{new_version}'

Python 2.7.13, bumpversion 0.5.3

Code0x58 commented 6 years ago

I just found this to be the case (0.5.3 under Python 3.6.4) in some situations. With my current config it happens when the current version is 0.2.0 but not when it is something 0.2.1.dev0. This is the config:

[bumpversion]
current_version = 0.2.0
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?:\.(?P<release>[a-z]+)(?P<release_number>\d+))?
serialize = 
    {major}.{minor}.{patch}.{release}{release_number}
    {major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = gamma
values = 
    dev
    rc
    gamma

[bumpversion:part:release_number]

[bumpversion:file:config/__init__.py]
search = __version__ = '{current_version}'
replace = {new_version}