bumpversion icon indicating copy to clipboard operation
bumpversion copied to clipboard

IndexError: list index out of range

Open brechtm opened this issue 9 years ago • 2 comments

$ 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.

brechtm avatar Dec 07 '16 12:12 brechtm

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

jessegonzalez avatar Jan 10 '17 03:01 jessegonzalez

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

JordiMontane avatar Sep 18 '17 14:09 JordiMontane