bump2version icon indicating copy to clipboard operation
bump2version copied to clipboard

Allow ignoring certain matches

Open ulope opened this issue 7 years ago • 2 comments

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.

ulope avatar Sep 04 '18 11:09 ulope

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?

c4urself avatar Nov 18 '18 23:11 c4urself

@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

matthewfeickert avatar Dec 14 '20 17:12 matthewfeickert