# HG changeset patch # User Pierre-Yves David # Date 1727442326 -7200 # Node ID bb281ecf4036b6ecbecd266cb42600191cb950be # Parent dd3ccda3abc82ee7bdba17e7b7027737df7e3f18 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. diff -r dd3ccda3abc8 -r bb281ecf4036 mercurial/branching/rev_cache.py --- 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 diff -r dd3ccda3abc8 -r bb281ecf4036 tests/test-branches.t --- 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