Skip to content

Conversation

@ecs-jnguyen
Copy link

Description

Hi I'm opening this PR to address this issue: #231

I am modifying the configuration loading piece of bump2version so that the cli arguments take precedence over the configurations in the file.

Behavior before pull request Example

Step 1 create .bumpversion.cfg and version.txt

.bumpversion.cfg

[bumpversion]
current_version = 0.8.0
serialize = {major}.{minor}
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))?

[bumpversion:file:version.txt]

version.txt:

0.8.0

Run bump2version

$ bump2version patch --serialize "{major}.{minor}.{patch}" --list
current_version=0.8.0
serialize={major}.{minor}
parse=(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))?
new_version=0.8.1

Results

  • .bumpversion.cfg == 0.8.1
  • version.txt == 0.8

Behavior after changes

[bumpversion]
current_version = 0.8.0
serialize = {major}.{minor}
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))?

[bumpversion:file:version.txt]

version.txt:

0.8.0

Run bump2version

$ bump2version patch --serialize "{major}.{minor}.{patch}" --list
current_version=0.8.0
serialize={major}.{minor}
parse=(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))?
new_version=0.8.1

Results

  • .bumpversion.cfg == 0.8.1
  • version.txt == 0.8.1

@florisla
Copy link
Collaborator

I think this makes sense... We can consider it for the next release.

@florisla florisla added this to the Next release milestone Oct 15, 2021
@florisla florisla self-requested a review October 15, 2021 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants