c4urself / bump2version

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

How to insert newlines in the replacement text #251

Closed stevendavis closed 1 year ago

stevendavis commented 2 years ago

I'm trying to update the version in the change log with this configuration:

[bumpversion:file:HISTORY.rst]
search = in_progress_version
replace = in_progress_version\n-------------------\ncoming soon\n\n{new_version}

How can I make bumpversion convert the \n to real newlines? Is there a better way to do this?

sanderr commented 1 year ago

The configuration file supports multi-line values, so you can just use actual newlines. If I understand your use case correctly: HISTORY.rst:

1.0.0
-------------------
- first major bump

0.0.2
-------------------
- added a new entry

0.0.1
-------------------
- created changelog

.bumpversion.cfg:

[bumpversion]
current_version = 1.0.0

[bumpversion:file:HISTORY.rst]
replace = {new_version}
    -------------------
    coming soon

    {current_version}
stevendavis commented 1 year ago

Thank you! You're right. Multi-line values work as expected.