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

Allow ignoring certain matches #38

Open ulope opened 6 years ago

ulope commented 6 years ago

It would be great if there was an option to exclude certain matches from bumping (e.g. by adding a ignore_regex or similar option).

The issue came up in a small project that has all its documentation inside a readme file, including multiple mentions of the current version as well as a changelog. The problem I'm running into is that bump(2)version also bumps the versions in the changelog section.

c4urself commented 5 years ago

This would get messy pretty quickly. Devil's advocate: would writing the suggested ignore_regex not take longer than adding a CHANGELOG.md and linking it from the README.md?

matthewfeickert commented 3 years ago

@c4urself Just to confirm, as I'm guessing lots has changes in two years in the project, that if we have a file that contains the following text

SCHEMA_VERSION = '0.5.4' # Do NOT match this, as it is coincidental
# But match both of these
"""
        '@software{software,  author = "{authors}",  title = "{software: v0.5.4}",  version = {0.5.4},  doi = {doi},  url = {url},}'
"""

with the .bumpversion.cfg containing

[bumpversion]
current_version = 0.5.4
commit = True
tag = True

[bumpversion:file:setup.cfg]

[bumpversion:file:file_in_question]

there is no way to use information from the parse option in the search and replace to guard the SCHEMA_VERSION from being bumped? In this example scenario having in .bumpversion.cfg

parse = (?<!')(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)

correctly matches what we want

regex_example

but from reading the README and Issues it seems that this information can only be used for the serialize option. Is this correct?

cc @lukasheinrich @kratsg