That is to say it inserts a new version header but leaves an "Unreleased" section at the top.
This works (yay) but I initially thought that it did not, because the displayed diff shows every later paragraph being changed:
.... many lines
@@ -565,2 +565 @@
-- Functions that should not be mutated can be marked with `#[mutants::skip]`
- from the [`mutants`](https://crates.io/crates/mutants) helper crate.
+## 0.0.2
@@ -568 +567,2 @@
-## 0.0.1
+- Functions that should not be mutated can be marked with `#[mutants::skip]`
+ from the [`mutants`](https://crates.io/crates/mutants) helper crate.
@@ -570 +570,3 @@
-First release.
+## 0.0.1
+
+First release.
I think this is because the diff code you're using isn't smart about looking for inserted lines.
It looks like you're using difflib 0.4. I would have guessed it would do better on this, but maybe not. Personally I have used https://crates.io/crates/similar in cargo-mutants and it does seem to get this kind of thing right. I will have a quick look.
In cargo-mutants Cargo.toml I have cargo-release text replacement set up like this:
That is to say it inserts a new version header but leaves an "Unreleased" section at the top.
This works (yay) but I initially thought that it did not, because the displayed diff shows every later paragraph being changed:
I think this is because the diff code you're using isn't smart about looking for inserted lines.
It looks like you're using difflib 0.4. I would have guessed it would do better on this, but maybe not. Personally I have used https://crates.io/crates/similar in cargo-mutants and it does seem to get this kind of thing right. I will have a quick look.