comparison mercurial/debugcommands.py @ 41964:e3307243d188

manifestcache: stop altering the lru cache order while displaying it Accessing value with `.get` alter the iteration order and make the output of the debug command misbehave, showing multiple entry twice. We need more than 2 entry to see the bug, so there are not test change. Later test will introduce a third entry and would fail without this fix.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 15 Mar 2019 13:52:36 +0000
parents 1fe278aa4ad5
children d121823072b8
comparison
equal deleted inserted replaced
41963:1fe278aa4ad5 41964:e3307243d188
1501 _('cache contains %d manifest entries, in order of most to ' 1501 _('cache contains %d manifest entries, in order of most to '
1502 'least recent:\n') % (len(cache),)) 1502 'least recent:\n') % (len(cache),))
1503 totalsize = 0 1503 totalsize = 0
1504 for nodeid in cache: 1504 for nodeid in cache:
1505 # Use cache.get to not update the LRU order 1505 # Use cache.get to not update the LRU order
1506 data = cache.get(nodeid) 1506 data = cache.peek(nodeid)
1507 size = len(data) 1507 size = len(data)
1508 totalsize += size + 24 # 20 bytes nodeid, 4 bytes size 1508 totalsize += size + 24 # 20 bytes nodeid, 4 bytes size
1509 ui.write(_('id: %s, size %s\n') % ( 1509 ui.write(_('id: %s, size %s\n') % (
1510 hex(nodeid), util.bytecount(size))) 1510 hex(nodeid), util.bytecount(size)))
1511 ondisk = cache._opener.stat('manifestfulltextcache').st_size 1511 ondisk = cache._opener.stat('manifestfulltextcache').st_size