c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.06k stars 133 forks source link

Handling version repetitions in a single file #4

Open ionelmc opened 6 years ago

ionelmc commented 6 years ago

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

ekohl commented 6 years ago

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?

c4urself commented 6 years ago

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

not sure what you mean here @ekohl ?

c4urself commented 6 years ago

@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

florisla commented 6 years ago

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

rominf commented 5 years ago

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.

florisla commented 4 years ago

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

LachlanMarnham commented 10 months ago

@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