Skip to content

Commit 693e804

Browse files
fix(bump): Support regexes containing colons
The version_files feature uses a colon to delimit filenames from a regex to use to find the version. Make version_files slightly more robust by splitting on the first colon rather than all colons, thereby permitting the regex to contain a colon. Maintain the pre-existing assumption that the filename doesn't contain a colon, as this is rare and would likely cause many other problems.
1 parent 2110a14 commit 693e804

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

commitizen/bump.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ def update_version_in_files(
141141
"""
142142
# TODO: separate check step and write step
143143
for location in files:
144-
filepath, *regexes = location.split(":")
145-
regex = regexes[0] if regexes else None
144+
filepath, _, regex = location.partition(":")
146145

147146
with open(filepath, "r") as f:
148147
version_file = f.read()

0 commit comments

Comments
 (0)