rev-branch-cache: fix message about overwritten data
If there is data at the end we ignore, we should not count them as overwritten.
This reveal that we something don't overwrite anything, this will be taken car
of in the next changeset.
--- a/mercurial/branching/rev_cache.py Fri Sep 27 02:27:54 2024 +0200
+++ b/mercurial/branching/rev_cache.py Fri Sep 27 15:05:26 2024 +0200
@@ -399,8 +399,9 @@
threshold = current_size * REWRITE_RATIO
if (max(end, current_size) - start) < threshold:
# end affected, let overwrite the bad value
+ overwritten = min(end, current_size) - start
dbg = b"overwriting %d bytes from %d in cache/%s"
- dbg %= (current_size - start, start, _rbcrevs)
+ dbg %= (overwritten, start, _rbcrevs)
if end < current_size:
extra = b" leaving (%d trailing bytes)"
extra %= current_size - end
--- a/tests/test-branches.t Fri Sep 27 02:27:54 2024 +0200
+++ b/tests/test-branches.t Fri Sep 27 15:05:26 2024 +0200
@@ -835,7 +835,7 @@
$ echo >> .hg/cache/rbc-revs-v2
$ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
5
- overwriting 2 bytes from 160 in cache/rbc-revs-v2 leaving (2 trailing bytes)
+ overwriting 0 bytes from 160 in cache/rbc-revs-v2 leaving (2 trailing bytes)
$ f --size .hg/cache/rbc-revs*
.hg/cache/rbc-revs-v2: size=162