-
My Configurationparse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
(?P<patch>0|[1-9]\\d*)
(?:
- # dash separator for pre-release section
(?P<pre_label>[a-zA-Z-]+) # pre-release label
(?P<pre_n>0|[1-9]\\d*) # pre-release version number
)? # pre-release section is optional
"""
serialize = [
"{major}.{minor}.{patch}-{pre_label}{distance_to_latest_tag}",
"{major}.{minor}.{patch}",
]
[tool.bumpversion.parts.pre_label]
values = ["dev", "rc", "final"]
optional_value = "final" My Pre-bump State$ bump-my-version show-bump
0.1.2-dev2 ── bump ─┬─ major ───── 1.0.0-dev2
├─ minor ───── 0.2.0-dev2
├─ patch ───── 0.1.3-dev2
╰─ pre_label ─ 0.1.2-rc2 After BumpInstead of [tool.bumpversion]
current_version = "0.1.2-rc2-dev2" The docs don't show any changes to the |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 9 replies
-
On the surface, nothing looks out of order. Can you run the bump command with I'm a bit stumped about what or where this could happen. So seeing the debug information is crucial. |
Beta Was this translation helpful? Give feedback.
-
@coordt here you go: $ bump-my-version bump pre_label -vv
Starting BumpVersion 0.28.3
Reading configuration
Reading config file: /home/doug/Projects/bar/.bumpversion.toml
Specified version (0.1.2-rc2-dev2) does not match last tagged version (0.1.2-rc2)
Parsing current version '0.1.2-rc2-dev2'
Parsing version '0.1.2-rc2-dev2' using regexp '(?x)
(?P<major>0|[1-9]\d*)\.
(?P<minor>0|[1-9]\d*)\.
(?P<patch>0|[1-9]\d*)
(?:
- # dash separator for pre-release section
(?P<pre_label>[a-zA-Z-]+) # pre-release label
(?P<pre_n>0|[1-9]\d*) # pre-release version number
)? # pre-release section is optional
'
Parsed the following values: major=0, minor=1, patch=2, pre_label=rc, pre_n=2
No setup hooks defined
Attempting to increment part 'pre_label'
Values are now: major=0, minor=1, patch=2, pre_label=final, pre_n=0
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=final, pre_n=0>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
New version will be '0.1.2'
File VERSION: replace `{current_version}` with `{new_version}`
Serializing the current version
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=rc, pre_n=2>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
Serializing the new version
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=final, pre_n=0>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
Rendering search pattern with context
No RegEx flag detected. Searching for the default pattern: '0\.1\.2'
Found '0\.1\.2' at line 1: 0.1.2
Rendering search pattern with context
No RegEx flag detected. Searching for the default pattern: '0\.1\.2\-rc2\-dev2'
Changing file VERSION:
*** before VERSION
--- after VERSION
***************
*** 1 ****
! 0.1.2-rc2-dev2
--- 1 ----
! 0.1.2
File README.md: replace `{current_version}` with `{new_version}`
Serializing the current version
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=rc, pre_n=2>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
Serializing the new version
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=final, pre_n=0>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
Rendering search pattern with context
No RegEx flag detected. Searching for the default pattern: '0\.1\.2'
Found '0\.1\.2' at line 4: 0.1.2
Rendering search pattern with context
No RegEx flag detected. Searching for the default pattern: '0\.1\.2\-rc2\-dev2'
Changing file README.md:
*** before README.md
--- after README.md
***************
*** 1,7 ****
# hot-garbage
- version
! : 0.1.2-rc2-dev2
- location
: https://gitlab.com/happy-fun-project/happy-fun-repo/hot-garbage
- installation
--- 1,7 ----
# hot-garbage
- version
! : 0.1.2
- location
: https://gitlab.com/happy-fun-project/happy-fun-repo/hot-garbage
- installation
Processing config file: /home/doug/Projects/bar/.bumpversion.toml
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=rc, pre_n=2>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=final, pre_n=0>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
Rendering search pattern with context
No RegEx flag detected. Searching for the default pattern: '0\.1\.2'
Found '0\.1\.2' at line 1: 0.1.2
Not changing file /home/doug/Projects/bar/.bumpversion.toml:tool.bumpversion.current_version
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=final, pre_n=0>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
No pre-commit hooks defined
Would not commit
Tagging 'v0.1.2' with message 'Bump version: 0.1.2-rc2-dev2 → 0.1.2' in Git and not signing
Serializing version '<bumpversion.Version:major=0, minor=1, patch=2, pre_label=final, pre_n=0>'
Using serialization format '{major}.{minor}.{patch}'
Serialized to '0.1.2'
No post-commit hooks defined
Done. $ head -2 .bumpversion.toml
[tool.bumpversion]
current_version = "0.1.2-rc2-dev2"
``
|
Beta Was this translation helpful? Give feedback.
-
Yes! Configuration is still: parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
(?P<patch>0|[1-9]\\d*)
(?:
- # dash separator for pre-release section
(?P<pre_label>[a-zA-Z-]+) # pre-release label
(?P<pre_n>0|[1-9]\\d*) # pre-release version number
)? # pre-release section is optional
"""
serialize = [
"{major}.{minor}.{patch}-{pre_label}{distance_to_latest_tag}",
"{major}.{minor}.{patch}",
]
[tool.bumpversion.parts.pre_label]
values = ["dev", "rc", "final"]
optional_value = "final" |
Beta Was this translation helpful? Give feedback.
-
@coordt just for context, I'm following the instructions step-by-step. I've created a very simple project: -rw-r--r-- 1 doug doug 6 Dec 19 08:31 VERSION
-rw-r--r-- 1 doug doug 173 Dec 19 08:31 README.md
-rw-r--r-- 1 doug doug 1.2K Dec 19 08:31 .bumpversion.toml All three files have a version in them. I test changes by editing the Auto-incrementing seems to work great with every commit. |
Beta Was this translation helpful? Give feedback.
-
I was able to reproduce the bug. I'll see what is going on. |
Beta Was this translation helpful? Give feedback.
-
I'm updating the documentation, but the answer is to change your parse configuration to: parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
(?P<patch>0|[1-9]\\d*)
(?:
- # dash separator for pre-release section
(?P<pre_l>[a-zA-Z-]+) # pre-release label
(?:0|[1-9]\\d*) # pre-release version number
)? # pre-release section is optional
""" |
Beta Was this translation helpful? Give feedback.
I'm updating the documentation, but the answer is to change your parse configuration to: