peritus / bumpversion

Version-bump your software with a single command
https://pypi.python.org/pypi/bumpversion
MIT License
1.5k stars 147 forks source link

IndexError: list index out of range #155

Open brechtm opened 7 years ago

brechtm commented 7 years ago
$ bumpversion release
Traceback (most recent call last):
  File "/Users/brechtm/.pyenv/versions/tox/bin/bumpversion", line 11, in <module>
    sys.exit(main())
  File "/Users/brechtm/.pyenv/versions/3.5.1/envs/tox/lib/python3.5/site-packages/bumpversion/__init__.py", line 816, in main
    new_version = current_version.bump(positionals[0], vc.order())
  File "/Users/brechtm/.pyenv/versions/3.5.1/envs/tox/lib/python3.5/site-packages/bumpversion/__init__.py", line 408, in bump
    new_values[label] = self._values[label].bump()
  File "/Users/brechtm/.pyenv/versions/3.5.1/envs/tox/lib/python3.5/site-packages/bumpversion/__init__.py", line 349, in bump
    return VersionPart(self.config.bump(self.value), self.config)
  File "/Users/brechtm/.pyenv/versions/3.5.1/envs/tox/lib/python3.5/site-packages/bumpversion/__init__.py", line 308, in bump
    return self._values[self._values.index(value)+1]
IndexError: list index out of range

This is the .bumpversion.cfg:

[bumpversion]
current_version = 0.3.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<release>.*)
serialize = 
    {major}.{minor}.{patch}{release}
    {major}.{minor}.{patch}
commit = False
tag = False

[bumpversion:part:release]
optional_value = production
values = 
    .dev
    production

Perhaps there is an error in my .bumpversion.cfg, but I'm not sure where. In any case, bumpversion shouldn't crash.

jessegonzalez commented 7 years ago

@brechtm I had the same problem. I installed from source off of 'master' and got the desired behavior.

JordiMontane commented 7 years ago

The situation here is that your current version is 0.3.0(production) were production is not visible because it is the optional_value. executing bumpversion release is trying to iterate from a list that has no more values.. so the next bumpversion action should be on the minor(or patch) part,not on release. if you do bumpversion patch you should get version 0.3.1.dev