bumpversion icon indicating copy to clipboard operation
bumpversion copied to clipboard

Cannot replace with multiple lines

Open dochang opened this issue 9 years ago • 5 comments

It seems that bumpversion doesn't work with multiline string.

Here is my CHANGELOG.md:

## Unreleased ##

  - xxxx

## 0.0.2 -- 2015-12-08 ##

  - yyyy

And here is my .bumpversion.cfg:

[bumpversion:file:CHANGELOG.md]
search = ## Unreleased ##
replace = ## Unreleased ##

  ## {new_version} - {utcnow:%Y-%m-%d} ##

After running bumpversion, the expected changelog is:

## Unreleased ##

## 0.0.3 -- 2015-12-09 ##

  - xxxx

## 0.0.2 -- 2015-12-08 ##

  - yyyy

But the actual content is:

## Unreleased ##
## 0.0.3 -- 2015-12-09 ##

  - xxxx

## 0.0.2 -- 2015-12-08 ##

  - yyyy

And .bumpversion.cfg is changed:

[bumpversion:file:CHANGELOG.md]
search = ## Unreleased ##
replace = ## Unreleased ##
        ## {new_version} - {utcnow:%Y-%m-%d} ##

Bumpversion removes the empty line.

How to replace current version with multiline string?

dochang avatar Dec 09 '15 19:12 dochang

This looks similar to #103, right ? I mean, the underlying issue seems to be the lack of proper multi-line support in parameters of bumpversion's own configuration blocks. There's probably a textwrap()to add somewhere in bumpversion config parsing.

kdeldycke avatar Jan 14 '16 13:01 kdeldycke

Yes, RawConfigParser in py2 doesn't recognize empty lines in multiple lines.

Instead of wrapping RawConfigParser, shall we switch to another parser, e.g., a toml parser?

dochang avatar Jan 14 '16 19:01 dochang

It happens to me too.

The fact that you can use to drop directly the changelog the multiline with blank lines is mandatory for md and rst formats.

nhomar avatar Apr 10 '16 07:04 nhomar

Heh, came here for exactly the same reason, trying to add my CHANGELOG release into versionbump...

Has anyone figured out a way to get that extra newline in there between the unreleased and the release?

aiguofer avatar Mar 24 '18 19:03 aiguofer

Just in case this is helpful to someone that finds this:

  • I figured out it works fine with no spacing if you use rst instead of md.
  • You should put this in .bumpversion.cfg instead of setup.cfg if you plan on building in python 3

aiguofer avatar Mar 26 '18 21:03 aiguofer