bump2version icon indicating copy to clipboard operation
bump2version copied to clipboard

Handling version repetitions in a single file

Open ionelmc opened this issue 6 years ago • 7 comments

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)?

ionelmc avatar Oct 31 '17 18:10 ionelmc

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?

ekohl avatar Jan 02 '18 16:01 ekohl

To play the devils advocate: Isn't v{current_version} specific enough for you?

not sure what you mean here @ekohl ?

c4urself avatar Apr 19 '18 16:04 c4urself

@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

c4urself avatar Apr 19 '18 16:04 c4urself

@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.

florisla avatar Aug 05 '18 21:08 florisla

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 avatar Nov 07 '18 13:11 rominf

@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?

florisla avatar Jan 13 '20 10:01 florisla

@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?

I think #111 fixes this issue, and #4 can be closed

LachlanMarnham avatar Dec 05 '23 17:12 LachlanMarnham