Skip to content

Commit

Permalink
Allow _custommessage suffix to the bumpversion:file section header
Browse files Browse the repository at this point in the history
So this becomes valid:
[bumpversion:file_myfile_first_pass:version.txt]
[bumpversion:file_myfile_second_pass:version.txt]

Fixes c4urself#111

Inspired by andrivet#3
  • Loading branch information
florisla committed Jan 13, 2020
1 parent 1b06fc7 commit 3f74e26
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bumpversion/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,14 @@ def _load_configuration(config_file, explicit_config, defaults):

part_configs = {}
files = []
file_or_part = re.compile("^bumpversion:(file|part):(.+)")
file_or_part = re.compile("^bumpversion:(file(_[^:]+)?|part):(.+)")
for section_name in config.sections():
section_name_match = file_or_part.match(section_name)

if not section_name_match:
continue

section_prefix, section_value = section_name_match.groups()
section_prefix, _file_suffix, section_value = section_name_match.groups()

section_config = dict(config.items(section_name))

Expand All @@ -306,7 +306,7 @@ def _load_configuration(config_file, explicit_config, defaults):
**section_config
)

elif section_prefix == "file":
elif section_prefix == "file" or section_prefix.startswith("file_"):
filename = section_value

if "serialize" in section_config:
Expand Down

0 comments on commit 3f74e26

Please sign in to comment.