Closed milkshoes closed 6 years ago
As your current files are there is no way that you can differentiate between your project version and matching versions of dependencies. What works in this situation is to eliminate the conflicts by adding a comment to the line with the version you want to bump, e.g. //bmp version.
Then add this extra comment to both the search and replace expressions in bumpversion configuration.
Note that trying to make bumpversion smarter, aka match first, match a specific line number, etc., will actually make it harder to use IMHO.
I've tried your suggestion to add a comment to both the search and replace expressions in the bump version configuration, but haven't been able to get it working as I need.
Below is just one of the versions I tried amongst many (Adding to the Replace expression was unusable):
[bumpversion]
current_version = 7.0.4
[bumpversion:file:build.sbt]
search = "version := {current_version} // CQcKBAgADA"
replace = "version := {new_version} // CQcKBAgADA"
[bumpversion:file:../surgery_exchange_build/build.sbt]
search = surgery-exchange-model_{current_version}
replace = surgery-exchange-model_{new_version}
name := "my-test-file-for-bumping"
version := ""7.0.4" // CQcKBAgADA
scalaVersion := ""7.0.4" // facdd81c
libraryDependencies ++= Seq(
javaJdbc,
filters,
"commons-collections" % "commons-collections" % "3.2.1",
"org.apache.tika" % "tika-core" % "1.13",
"org.apache.tika" % "tika-parsers" % "1.13",
"junit" % "junit" % "4.12" % "test"
)
publishMavenStyle := true
Hi, Using your "demo" files I modified them and this works for me: .bumpversion.cfg
[bumpversion]
current_version = 6.26.0
[bumpversion:file:bumpfile.txt]
search = version := "{current_version}" //PACKAGE VERSION HERE
replace = version := "{new_version}" //PACKAGE VERSION HERE
bumpfile.txt
name := "my-test-file-for-bumping"
version := "6.26.0" //PACKAGE VERSION HERE
scalaVersion := "6.26.0" // This shouldn't match!
whateverVersion := "6.26.0" // This too shouldn't match!
libraryDependencies ++= Seq(
javaJdbc,
filters,
"commons-collections" % "commons-collections" % "3.2.1",
"org.apache.tika" % "tika-core" % "1.13",
"org.apache.tika" % "tika-parsers" % "1.13",
"junit" % "junit" % "4.12" % "test"
)
publishMavenStyle := true
Thanks, your version works for me. Thought I had tried that combination as one of my tests with no luck. Must have been pebkac because of the quotes.
I'm sorry in advance if this is described in the documentation somewhere. I didn't quite see the exact scenario I'm encountering described in the "search =" section or the "Python Format String Syntax" and haven't been able to get what I need to work.
My need is this: I have a bumpversion config file as listed below. However, I need it to only bump a specific match and only that match in a file because we could potentially have one or many similar patterns with the same number occur and it's currently replacing all of them throughout the file which is not the desired result.
The desired result is to only change the 'version := "6.26.0"' and NOT the 'scalaVersion := "6.26.0"'. My current search = pattern is affecting both versions when the numbers match and that is not usable.
Any help is greatly appreciated and thank you!
My current .bumpversion.cfg:
The file with potential bumping conflicts: