Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new-version value is not used for other files than .bumpversion.cfg #60

Closed
cscetbon opened this issue Oct 31, 2014 · 12 comments · Fixed by #81
Closed

new-version value is not used for other files than .bumpversion.cfg #60

cscetbon opened this issue Oct 31, 2014 · 12 comments · Fixed by #81
Labels

Comments

@cscetbon
Copy link

Hey,

I'm trying to use new-version to set a custom version but while it's correctly changed in the .bumpversion.cfg, it's not in the file added to the "files" list :

bumpversion patch --allow-dirty --dry-run --verbose --new-version 0.9.3

I can't understand why the part is mandatory when we provide a custom version for the package, but in my case, the part is used to increment the version in the file while the version in .bumpversion.cfg is set to the 0.9.3
I would expect to have versions set to 0.9.3 everywhere

Here is the output of the dry-run :

Reading config file .bumpversion.cfg:
[bumpversion]
current_version = 0.7.2
files = myp/__init__.py
message = v{new_version}
tag_name = {new_version}
tag = true
commit = true

Parsing version '0.7.2' using regexp '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'
Parsed the following values: major=0, minor=7, patch=2
Attempting to increment part 'patch'
Values are now: major=0, minor=7, patch=3
Dry run active, won't touch any files.
New version will be '0.9.3'
Asserting files myp/__init__.py contain the version string:
Found '0.7.2' in myp/__init__.py at line 0: __version__ = '0.7.2'
Would change file myp/__init__.py:
--- a/myp/__init__.py
+++ b/myp/__init__.py
@@ -1,4 +1,4 @@
-__version__ = '0.7.2'
+__version__ = '0.7.3'

 try:
     from myp.mapping import Digest
Would write to config file .bumpversion.cfg:
[bumpversion]
current_version = 0.9.3
files = myp/__init__.py
message = v{new_version}
tag_name = {new_version}
tag = true
commit = true

Would prepare Git commit
Would add changes in file 'myp/__init__.py' to Git
Would add changes in file '.bumpversion.cfg' to Git
Would commit to Git with message 'v0.9.3'
Would tag '0.9.3' in Git
@peritus
Copy link
Owner

peritus commented Oct 31, 2014

.. that is, if you don't use --dry-run, there is 0.9.3 in the .bumpversion.cfg afterwards and 0.7.2 in in myp/__init__.py ?

Could you try using the new files config syntax introduced in 0.5.0, for your case that would be removing

files = myp/__init__.py

and adding as a separate section

[bumpversion:file:myp/__init__.py]

and see whether the result is different (see README for details) ?

@peritus
Copy link
Owner

peritus commented Oct 31, 2014

Sounds like a bug in bumpversion to me, even if only when importing pre-0.5 config files.

@cscetbon
Copy link
Author

do you still want me to try what you suggested ?

@peritus
Copy link
Owner

peritus commented Oct 31, 2014

Using the new syntax could be a workaround that might work for you until I have a regression test at hand / released a fix if I can verify the defect.

@cscetbon
Copy link
Author

Not better with the new syntax. the part is applied to the file while the new-version value is only applied to .bumpversion.cfg

@cscetbon
Copy link
Author

@peritus Can you label this issue as bug ?

@peritus peritus added the defect label Nov 12, 2014
@peritus
Copy link
Owner

peritus commented Nov 12, 2014

Yes it's a bug ;)

@cscetbon
Copy link
Author

Thanks

peritus added a commit that referenced this issue Jan 5, 2015
@petebrowne
Copy link

Has this been fixed yet? I'm running into this problem with v0.5.1.

[bumpversion]
current_version = 0.8.0

[bumpversion:file:project/__init__.py]
# project/__init__.py
__version__ = "0.8.0"
$ bumpversion patch --allow-dirty --verbose --new-version 0.9.0
# Reading config file .bumpversion.cfg:
# [bumpversion]
# current_version = 0.8.0
# 
# [bumpversion:file:project/__init__.py]
# 
# 
# Parsing version '0.8.0' using regexp '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'
# Parsed the following values: major=0, minor=8, patch=0
# Attempting to increment part 'patch'
# Values are now: major=0, minor=8, patch=1
# New version will be '0.9.0'
# Asserting files project/__init__.py contain the version string:
# Found '0.8.0' in project/__init__.py at line 0: __version__ = "0.8.0"
# Changing file project/__init__.py:
# --- a/project/__init__.py
# +++ b/project/__init__.py
# @@ -1,3 +1,3 @@
# -__version__ = "0.8.0"
# +__version__ = "0.8.1"
# Writing to config file .bumpversion.cfg:
# [bumpversion]
# current_version = 0.9.0
# 
# [bumpversion:file:project/__init__.py]
# 
# 
# Would prepare Git commit
# Would prepare Git commit
# Would add changes in file 'project/__init__.py' to Git
# Would add changes in file '.bumpversion.cfg' to Git
# Would commit to Git with message 'Bump version: 0.8.0 → 0.9.0'
# Would tag 'v0.9.0' in Git

@cscetbon
Copy link
Author

@petebrowne the PR is still opened, so I guess it's still pending

@peritus
Copy link
Owner

peritus commented Mar 21, 2015

This has not been fixed yet, willing to merge patches including tests and docs (ok, well, one regression test exists already).

Sent from my pocket calculator

On 21 Mar 2015, at 20:48, cscetbon [email protected] wrote:

@petebrowne the PR is still opened, so I guess it's still pending


Reply to this email directly or view it on GitHub.

ecordell pushed a commit to ecordell/bumpversion that referenced this issue Mar 26, 2015
Conflicts:
	tests.py
ecordell pushed a commit to ecordell/bumpversion that referenced this issue Mar 26, 2015
Assumes that if you pass --new-version, you want to override all other version bumping.
ecordell pushed a commit to ecordell/bumpversion that referenced this issue Mar 26, 2015
Assumes that if you pass --new-version, you want to override all other version bumping.
@petebrowne
Copy link

Awesome! When will this be released to pypi?

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 a pull request may close this issue.

3 participants