bumpversion icon indicating copy to clipboard operation
bumpversion copied to clipboard

Enforce command arguments

Open camilonova opened this issue 9 years ago • 7 comments

$ bumpversion mayor
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 994, in main
    vcs.commit(message=commit_message)
  File "/Library/Python/2.7/site-packages/bumpversion/__init__.py", line 73, in commit
    list(os.environ.items()) + [(b'HGENCODING', b'utf-8')]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'git', u'commit', u'-F', '/var/folders/l4/ymflzg114nscdbv54l1g_rr00000gn/T/tmp6ogPhi']' returned non-zero exit status 1

It should tell me mayor is not a valid argument.

camilonova avatar Jun 16 '15 14:06 camilonova

Yes, you're right. Thanks for finding this!

Would you want to prepare a pull-request?

peritus avatar Jun 16 '15 14:06 peritus

I tried to fix it, but your argument parsing seems more complicated that it should be.

camilonova avatar Jun 16 '15 18:06 camilonova

I ran into this problems as well (accidentally ran bumpversion bugfix rather than bumpversion patch), but in my case it had rather disastrous consequences. I'm using this .bumpversion.cfg:

[bumpversion]
current_version = 1.3.6
commit = True
tag = True
tag_name = {new_version}

[bumpversion:file:tmtpds/__init__.py]

[bumpversion:file:requirements.Linux.rpm.txt]
search = tmtpds.git@{current_version}
replace = tmtpds.git@{new_version}

When I ran bumpversion bugfix, it made an incorrect change to requirements.Linux.rpm.txt, then committed with a "Bump version: 1.3.4 → 1.3.4" commit message. But it didn't tag the commit, and didn't bump the version number.

The incorrect change it made was:

diff --git a/requirements.Linux.rpm.txt b/requirements.Linux.rpm.txt
index 42ecad9..2f1b6b9 100644
--- a/requirements.Linux.rpm.txt
+++ b/requirements.Linux.rpm.txt
@@ -29,4 +29,4 @@ Unidecode==0.04.16
 # Update this for every release build.
--e [email protected]:[REDACTED]/[email protected]#egg=tmtpds
+-e [email protected]:[REDACTED]/[email protected]@1.3.4#egg=tmtpds

Notice that it duplicated tmtpds.git@ and didn't bump the version.

Since I have bumpversion configured to immediately commit the changes it makes, this problem silently crept into my git repo without me noticing. That is a critical bug that requires immediate developer intervention.

coredumperror avatar Jul 17 '15 18:07 coredumperror

Hey, @coredumperror could you make a new issue for this maybe including more details or a reduced test case so I can look into this ? I don' think this is related to the original issue @camilonova is describing here.

peritus avatar Nov 09 '15 16:11 peritus

@camilonova yes, bumpversion is just config parsing at heart. But there's a very heavy test suite I use to keep myself from breaking things accidentally :) If you use that you should be on the safe side.

peritus avatar Nov 09 '15 16:11 peritus

@camilonova Also, if you'd like me to take a look at this problem could you please share your config and/or a (reduced) test case so I can reproduce this ?

peritus avatar Nov 09 '15 16:11 peritus

@peritus Sure, I'll open a new issue. I managed to replicate it with a super simply repo, so it shouldn't be hard to track down.

coredumperror avatar Nov 09 '15 20:11 coredumperror