##// END OF EJS Templates
rev-branch-cache: stop pretending we will overwrite data when we don't...
marmoute -
r52867:4c885d5f default
parent child Browse files
Show More
@@ -397,11 +397,15 class revbranchcache:
397 397 start = 0
398 398 if current_size != start:
399 399 threshold = current_size * REWRITE_RATIO
400 if (max(end, current_size) - start) < threshold:
401 # end affected, let overwrite the bad value
402 400 overwritten = min(end, current_size) - start
401 if (max(end, current_size) - start) >= threshold:
402 start = 0
403 dbg = b"resetting content of cache/%s\n" % _rbcrevs
404 repo.ui.debug(dbg)
405 elif overwritten > 0:
406 # end affected, let us overwrite the bad value
403 407 dbg = b"overwriting %d bytes from %d in cache/%s"
404 dbg %= (overwritten, start, _rbcrevs)
408 dbg %= (current_size - start, start, _rbcrevs)
405 409 if end < current_size:
406 410 extra = b" leaving (%d trailing bytes)"
407 411 extra %= current_size - end
@@ -409,9 +413,12 class revbranchcache:
409 413 dbg += b'\n'
410 414 repo.ui.debug(dbg)
411 415 else:
412 start = 0
413 dbg = b"resetting content of cache/%s\n" % _rbcrevs
416 # extra untouched data at the end, lets warn about them
417 assert start == end # since don't write anything
418 dbg = b"cache/%s contains %d unknown trailing bytes\n"
419 dbg %= (_rbcrevs, current_size - start)
414 420 repo.ui.debug(dbg)
421
415 422 if start > 0:
416 423 f.seek(start)
417 424 f.write(self._rbcrevs.slice(start, end))
@@ -835,7 +835,7 recovery from invalid cache revs file wi
835 835 $ echo >> .hg/cache/rbc-revs-v2
836 836 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
837 837 5
838 overwriting 0 bytes from 160 in cache/rbc-revs-v2 leaving (2 trailing bytes)
838 cache/rbc-revs-v2 contains 2 unknown trailing bytes
839 839 $ f --size .hg/cache/rbc-revs*
840 840 .hg/cache/rbc-revs-v2: size=162
841 841
General Comments 0
You need to be logged in to leave comments. Login now