c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.06k stars 134 forks source link

TypeError raised when current-version is undefined due to config file not found #170

Open ksangster opened 3 years ago

ksangster commented 3 years ago

I ran this in the wrong directory, hence .bumpversion.cfg was not found.

$bump2version --dry-run --allow-dirty --verbose --new-version 0.12.11 patch
Could not read config file at .bumpversion.cfg
Dry run active, won't touch any files.
New version will be '0.12.11'
Asserting files  contain the version string...
new_version=0.12.11
Would write to config file .bumpversion.cfg:
[bumpversion]
current_version = 0.12.11

Would prepare Git commit
Traceback (most recent call last):
  File "/home/ksngstr/.local/bin/bump2version", line 11, in <module>
    sys.exit(main())
  File "/home/ksngstr/.local/lib/python3.6/site-packages/bumpversion/cli.py", line 136, in main
    args, current_version, new_version)
  File "/home/ksngstr/.local/lib/python3.6/site-packages/bumpversion/cli.py", line 693, in _commit_to_vcs
    context.update({'current_' + part: current_version[part].value for part in current_version})
TypeError: 'NoneType' object is not iterable

It shouldn't assume there is a config file; if it does create it in order to write the current-version, why not use the same value? OR does the error occur when the current-version and the new-version are the same?

Same error as #93 but different cause? Related to the discussion in #30