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

Issues with using a config file specified part without command line part argument. #165

Open jackton1 opened 6 years ago

jackton1 commented 6 years ago

When I run the same command using --dry-run it executes without the part positional argument added.

Also running with --verbose option it works fine.

Sample command

bumpversion --allow-dirty --list --config-file /path/to/.bumpversion-local.cfg patch /path/to/setup.py My sample config file

[bumpversion]
current_version = 1.0.21
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize = {major}.{minor}.{patch}
commit = True
tag = False
message = "{now:%Y-%m-%d %H:%M} - Increased version: {current_version} to {new_version}"

[bumpversion:part:patch]

[bumpversion:file:/path/to/setup.py]
search = version="{current_version}"

Raises

Traceback (most recent call last):
  File "/usr/local/bin/bumpversion", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/bumpversion/__init__.py", line 912, in main
    f.should_contain_version(current_version, context)
  File "/Library/Python/2.7/site-packages/bumpversion/__init__.py", line 202, in should_contain_version
    if self.contains(serialized_version):
  File "/Library/Python/2.7/site-packages/bumpversion/__init__.py", line 214, in contains
    with io.open(self.path, 'rb') as f:
IOError: [Errno 2] No such file or directory: 'patch'
odoublewen commented 6 years ago

I ran into this problem too, and found that -n and --dry-run are not equivalent, even though the usage message says they should be:

  --dry-run, -n         Don't write any files, just pretend. (default: False)

With -n I get the error your report. With --dry-run it works as advertised. @jackton1 - Which are you using?