peritus / bumpversion

Version-bump your software with a single command
https://pypi.python.org/pypi/bumpversion
MIT License
1.5k stars 148 forks source link

Support for handling release dates #144

Open brechtm opened 8 years ago

brechtm commented 8 years ago

Most software will also store a release date along with the release number. I was hoping bumpversion could also set the release date for me. The search/replace options looked promising, but alas, I couldn't get it to work.

This would require the search option to recognize datetime formats or regexes. Even better, bumpversion could record the last release's date in it's config file, so a {current_date} could be used to search for the text to replace.

peritus commented 8 years ago

also set the release date for me

Can you elaborate on that ?

You can use {now:%d.%m.%Y} in both the tag and the message template string.

See https://github.com/peritus/bumpversion/blob/6ec908f018a827bfae94ed50baf241461eba7bcb/tests/test_cli.py#L1520-L1533 for an example that automatically adds a section to the changelog, with the current date.

brechtm commented 8 years ago

Sorry, I should have been more specific. I want to record the release date in a Python source file.

This works for a changelog, because it adds a new section. But for recording the release date in a Python source file, it needs to replace the old release date.

benoistlaurent commented 7 years ago

Same problem here. Would be extremely useful if it was possible to replace

This is myprogram 1.0.0 (2015-06-15)

with

This is myprogram 1.1.0 (2016-11-07)
haidaraM commented 6 years ago

Same issue here too. Hope this will be available

arcanefoam commented 6 years ago

I solved this by making the date part of the parse regex, but not using it as part of the version parts. So my cfg looks like this:

[bumpversion] current_version = 2016/06/04 1.0 serialize = {now:%Y/%m/%d} {major}.{minor} parse = \d{4}/\d{2}/\d{2}\s(?P<major>\d+)\.(?P<minor>\d+) ...

dgarrimar commented 2 years ago

What about a situation where there is a line break in the middle? i.e.

Version: 1.0.0
Date: yyyy/mm/dd

can bump2version handle the newline to match the pattern?