bump2version
bump2version copied to clipboard
Handling version repetitions in a single file
So a question for @c4urself I guess ...
There's one design issue in bumpversion that really grinds my gears: it cannot deal with files that have the version multiple times in them. Consider this README.rst
:
.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-nameless/v0.1.0.svg
:alt: Commits since latest release
:target: https://github.com/ionelmc/python-nameless/compare/v0.1.0...master
To be really sure no other content is changed I would need to have something like:
[bumpversion:file:README.rst]
search =
commits-since/ionelmc/python-nameless/v{current_version}.svg
compare/v{current_version}...master
Obviously this doesn't work, bumpversion will try to replace \ncommits-since/ionelmc/python-nameless/v{current_version}.svg\ncompare/v{current_version}...master
. To make it worse, it won't report any error.
So my question, are you interested in figuring out a better configuration format or I'm barking at the wrong tree (I should make my own fork or whatever)?
I can't answer for @c4urself but I'm sure we'd accept a PR to handle something like. To play the devils advocate: Isn't v{current_version}
specific enough for you?
To play the devils advocate: Isn't v{current_version} specific enough for you?
not sure what you mean here @ekohl ?
@ionelmc -- I think we should make the multiple instances of a version in a single file problem work if possible, more than happy to look at a PR
@ionelmc The 'devils advocate' question by ekols refers to the fact that multi-occurring version strings are supported if you're not using search
but the regular parse
.
So the question is, do you really need search
or can you make do with parse
until multi-search is functional.
I think that it would be useful to support Python regexes in parse
.
Also, I would use predefined parse
for special files, like setup.py
.
@rominf Python regex syntax is already supported in parse
. Did you mean 'to support multiple regexes' ?
I think the 'multiple parse' feature overlaps partly with #111 ('process a file multiple times'). The latter is more flexible as it also allows to have customized search
, replace
and serialize
too.
Would #111 cover everyone's needs?
@rominf Python regex syntax is already supported in
parse
. Did you mean 'to support multiple regexes' ?I think the 'multiple parse' feature overlaps partly with #111 ('process a file multiple times'). The latter is more flexible as it also allows to have customized
search
,replace
andserialize
too.Would #111 cover everyone's needs?
I think #111 fixes this issue, and #4 can be closed