Closed matthijskooijman closed 4 years ago
Same problem here; unknown parts should probably just result in a useful error message.
I'm also seeing it, but I'm doing the unknown part thing on purpose, using it to manage -rc0
suffixes patterened on
I just tried bump2version on a project I inherited, and it behaved a little bit surprising when I passed a non-existent "part". Of course the problem was that I read the docs too fast and remembered "revision" rather than "patch", but the lack of error message made me think I remembered correctly.
From reading some issues here, I understand that this has somewhat become a feature to work around #22, but I still think it warrants a separate issue and fixing.
First off, it seems that without further configuration, an unknown part simply does nothing (except when
--new-version
is supplied, in which case I guess the part is not used at all):On particularly weird version of this is with a search replace config:
It seems that somehow only the version number is replaced, rather than the entire
search
match, but with${new_version}
to the old version. Note that.bumpversion.cfg
is also not updated. I get exactly the same result when specifying a correctpart
and new-version (e.g.bump2version --new-version 3.0.1 patch
). I also tried changingreplace
toreplace = VERSION2 = "{new_version}"
, to see whether it used thesearch
orreplace
part in the output, but then the problem went away (it would replaceVERSION
byVERSION2
, but nothing else).OTOH, when omitting the new version, the results are correct (and
.bumpversion.cfg
is updated):A related but different issue is this backtrace when specifying a new-version, but not a current-version. If this is not supported, it should probably just tell me that :-)