Mercurial > hg
diff tests/test-branches.t @ 29615:a2a380e2750f stable
rbc: fix superfluous rebuilding from scratch - don't abuse self._rbcnamescount
The code used self._rbcnamescount as if it was the length of self._names ...
but actually it is just the number of good entries on disk. This caused the
cache to be populated inefficiently. In some cases very inefficiently.
Instead of checking the length before lookup, just try a lookup in self._names
- that is also in most cases faster.
Comments and debug messages are tweaked to help understanding the issue
and the fix.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 18 Jul 2016 22:25:09 +0200 |
parents | 5c79bae8166f |
children | 0d588332ad2c |
line wrap: on
line diff
--- a/tests/test-branches.t Mon Jul 18 22:23:44 2016 +0200 +++ b/tests/test-branches.t Mon Jul 18 22:25:09 2016 +0200 @@ -587,6 +587,8 @@ $ f --size .hg/cache/rbc-revs* .hg/cache/rbc-revs-v1: size=120 $ hg log -r 'branch(.)' -T '{rev} ' --debug + history modification detected - truncating revision branch cache to revision 13 + history modification detected - truncating revision branch cache to revision 1 3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug 5 @@ -632,7 +634,7 @@ cache is rebuilt when corruption is detected $ echo > .hg/cache/rbc-names-v1 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug - rebuilding corrupted revision branch cache + referenced branch names not found - rebuilding revision branch cache from scratch 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40 $ f --size --hexdump .hg/cache/rbc-* .hg/cache/rbc-names-v1: size=79 @@ -688,16 +690,13 @@ 0010: 56 46 78 69 00 00 00 01 |VFxi....| $ : > .hg/cache/rbc-revs-v1 +No superfluous rebuilding of cache: $ hg log -r "branch(null)&branch(branch)" --debug - rebuilding corrupted revision branch cache - rebuilding corrupted revision branch cache - truncating cache/rbc-revs-v1 to 8 -BUG: the cache was declared corrupt multiple times and not fully rebuilt: $ f --size --hexdump .hg/cache/rbc-* .hg/cache/rbc-names-v1: size=14 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch| .hg/cache/rbc-revs-v1: size=24 - 0000: 00 00 00 00 00 00 00 00 fa 4c 04 e5 00 00 00 00 |.........L......| + 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......| 0010: 56 46 78 69 00 00 00 01 |VFxi....| $ cd ..