peritus / bumpversion

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

`--dry-run` not parsed the same as `-n` #129

Open twall opened 8 years ago

twall commented 8 years ago

If I use -n the argument is parsed as a part (version 0.5.3).

.bumpversion.cfg:

[bumpversion]
current_version = 0.1.0
files = setup.py
commit = False
tag = False
tag_name = csf-google-{new_version}
parse = (?P<major>\d+)
        \.(?P<minor>\d+)
        \.(?P<patch>\d+)
        ((?P<release>[a-z]+)(?P<dev>\d+))?
serialize =
        {major}.{minor}.{patch}{release}{dev}
        {major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = placeholder
first_value = dev
values =
        dev
        placeholder
nehalecky commented 8 years ago

I've also hit the same issue via bumpversion -n --allow-dirty minor:

Traceback (most recent call last):
  File "/Users/nehalecky/miniconda2/envs/bombora/bin/bumpversion", line 11, in <module>
    sys.exit(main())
  File "/Users/nehalecky/miniconda2/envs/bombora/lib/python3.5/site-packages/bumpversion/__init__.py", line 912, in main
    f.should_contain_version(current_version, context)
  File "/Users/nehalecky/miniconda2/envs/bombora/lib/python3.5/site-packages/bumpversion/__init__.py", line 202, in should_contain_version
    if self.contains(serialized_version):
  File "/Users/nehalecky/miniconda2/envs/bombora/lib/python3.5/site-packages/bumpversion/__init__.py", line 214, in contains
    with io.open(self.path, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'minor'

Running with bumpversion --dry-run --allow-dirty minor works just fine. :)

michaelaye commented 8 years ago

Same here, -n is not properly parsed, --dry-run is fine. Cost me half an hour to see what's going wrong. :(

ulope commented 8 years ago

I also ran into this today. Looking at the code it's not obvious why it should behave this way however the code is sufficiently complex (300+ lines of intermixed cli args and config file parsing) to not be easy to understand.

ptim commented 7 years ago

me too :)

[sorry, still not sure which of these emojis signals a literal +1 (cos 👍 kinda implies 'nice work' / 'i like this')]

michaelaye commented 7 years ago

bump (the irony! ;)

jobevers commented 7 years ago

Its been fixed in https://github.com/peritus/bumpversion/commit/6ec908f018a827bfae94ed50baf241461eba7bcb but apparently not released yet.

gasparka commented 6 years ago

Also lost some time because of this, looks like abandonware :(

tsvi commented 6 years ago

Same here. At least didn't spent more than an hour on this issue.

dekoza commented 5 years ago

This should be ported to click - it does much better work at parsing arguments.