I want to use bump2version for a file that looks like this (it's a rust Cargo.toml):
[package]
name = "my_super_package"
version = "0.1.34"
...
[dependencies]
my_other_super_package = { path = "../yadayadayada", version = "0.1.34", registry = "crates-haha" }
...
In the .bumpversion.cfg
file, I cannot just use
[bumpversion:file:Cargo.toml]
parse = qv\((?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
because that would accidentally also change the unrelated version of my_other_super_package
that coincidentally has the same version number.
The bump2version
docs say that search and replace can handle multi-line specs, so I tried
[bumpversion:file:Cargo.toml]
search = name = "my_super_package"\nversion = "{current_version}"
replace = name = "my_super_package"\nversion = "{new_version}"
but the newlines didn't seem to be matched. I also tried
[bumpversion:file:Cargo.toml]
parse = qv(^version = \((?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+))
but the "^version = " part seems to be ignored.
Help?