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

Bumpversion fails when a part only contain one non-numeric part value #185

Open mfcabrera opened 6 years ago

mfcabrera commented 6 years ago

I am attempting to use the following configuration:

current_version = 0.1-staging
parse = (?P<major>\d+)\.(?P<minor>\d+)(-(?P<release>[a-z]+))? 
commit = False
tag = False
serialize =
  {major}.{minor}-{release}
  {major}.{minor}

[bumpversion:file:sales_ground_truth/VERSION]

[bumpversion:part:release]
values =
    staging

The Idea is to have things like: 0.1-staging -> 0.1 and so on. However, with this configuration I get the following error:

Parsed the following values: major=0, minor=1, release=staging
Attempting to increment part 'release'
Traceback (most recent call last):
  File "/Users/mcabrera/development/sales_ground_truth/sales_gt_env/bin/bumpversion", line 11, in <module>
    sys.exit(main())
  File "/Users/mcabrera/development/sales_ground_truth/sales_gt_env/lib/python3.6/site-packages/bumpversion/__init__.py", line 816, in main
    new_version = current_version.bump(positionals[0], vc.order())
  File "/Users/mcabrera/development/sales_ground_truth/sales_gt_env/lib/python3.6/site-packages/bumpversion/__init__.py", line 408, in bump
    new_values[label] = self._values[label].bump()
  File "/Users/mcabrera/development/sales_ground_truth/sales_gt_env/lib/python3.6/site-packages/bumpversion/__init__.py", line 349, in bump
    return VersionPart(self.config.bump(self.value), self.config)
  File "/Users/mcabrera/development/sales_ground_truth/sales_gt_env/lib/python3.6/site-packages/bumpversion/__init__.py", line 308, in bump
    return self._values[self._values.index(value)+1]
IndexError: list index out of range```

If I add an optional value: 

[bumpversion:part:release] optional_value = gamma values = staging gamma



This works with no problem.