diff mercurial/branching/rev_cache.py @ 51969:bb281ecf4036

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 27 Sep 2024 15:05:26 +0200
parents 16efed18ae4e
children 4c885d5ff132
line wrap: on
line diff
--- 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