c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.06k stars 134 forks source link

strict search #60

Open jgroom33 opened 5 years ago

jgroom33 commented 5 years ago

Current behavior:

config:

[bumpversion:file:CHANGES.md]
search = Version Future
replace = Version {new_version}

Assume this CHANGES.md:

Version 0.0.1
--------------

bump2version patch Result:

Version Version 0.0.2
--------------

Expected result:

Version 0.0.1
--------------
kepler commented 5 years ago

I was having the same problem. Apparently, if bump2version doesn't find the search pattern, it falls back to the default {current_version}.

In my case, I had a typo in the pattern, and that was producing the same result as yours. After fixing it, it worked as expected.

jgroom33 commented 5 years ago

In this scenario, there is no misspelling. It is desirable that there is no fallback.

Ideally, there should be a way to handle changes.md in a better manner while migrating from dev version to patch/minor/major version and back.

Specifically, the goal is to have 'version future' only exist in the dev version. This would be replaced with the minor/major/patch during bump. When bump to dev, 'version future' is reapplied.

kepler commented 5 years ago

Yes, I agree it shouldn't fall back to the default pattern. If it doesn't find the specified search pattern, it should simply skip the file.

florisla commented 5 years ago

I agree that the fallback should not occur. Issue #76 was a similar confusion caused by it.

At the very least, the fallback should generate some very explicit warning.