bumpversion icon indicating copy to clipboard operation
bumpversion copied to clipboard

Can't get "search" to work

Open TAGC opened this issue 8 years ago • 4 comments

I'm developing an ASP.NET Core project that I want to be able to bump the version of. It has a project.json file that contains the version string of the project itself (which I want to be bumped) and many other version strings corresponding to its dependencies (that I would like to be ignored):

{
  "version": "0.1.1-*",
  ...
  "dependencies": {
    "BundlerMinifier.Core": "2.2.281",
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.1",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    ...
  }
  ...
}

In my root directory I define this .bumpversion.cfg file:

[bumpversion]
current_version = 0.1.1
commit = True
tag = False

[bumpversion:file:src/AtpGroup.Communications.TestBed/project.json]
search = version: '{current_version}-*'

I'm trying to configure search to only bump a version string that ends in "-*". This doesn't seem to have any effect, nor does something like '{current_version} blah blah blah' - it still finds and replaces the version strings of dependencies that are also '0.1.0'.

I'm using bumpversion 0.5.4.dev0 (installed using pip install git+git://github.com/smsearcy/bumpversion.git@issue-135) on a Windows 7 64-bit machine through the Git Bash shell.

TAGC avatar Sep 29 '16 12:09 TAGC

I have this problem too

christiandrago avatar Feb 16 '17 14:02 christiandrago

I am also having problems with search, specifically multi-line pattern matching.

odoublewen avatar Aug 22 '17 22:08 odoublewen

@TAGC I got your example to work, you just had the pattern wrong in the config file. Set it up like this:

search = "version": "{current_version}-*"
replace = "version": "{new_version}-*"

This doesn't help me with multi-line pattern matching...

odoublewen avatar Aug 23 '17 04:08 odoublewen

In my case, I am trying to match multiple lines of an xml file. Because it's an xml file, there is the typical whitespace beginning every line. But python ConfigParser strips whitespace when it parses the .cfg file. So it appears that search will not support multi-line patterns with leading whitespace (trailing too, I assume).

odoublewen avatar Aug 23 '17 05:08 odoublewen