comparison mercurial/debugcommands.py @ 41964:d121823072b8

manifestcache: protect write with `wlock` instead of `lock` The `wlock` is taken by both `update` and `commit` type operation. This would help persisting the cache more aggressively. An explicit test is introduced. However, we can already see the effect of this change on earlier test output.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 15 Mar 2019 15:07:43 +0000
parents e3307243d188
children 6ae1a776dd1a
comparison
equal deleted inserted replaced
41963:6386f9a421d2 41964:d121823072b8
1474 msg = _("Current revlog implementation doesn't appear to have a " 1474 msg = _("Current revlog implementation doesn't appear to have a "
1475 "manifest fulltext cache\n") 1475 "manifest fulltext cache\n")
1476 raise error.Abort(msg) 1476 raise error.Abort(msg)
1477 1477
1478 if opts.get(r'clear'): 1478 if opts.get(r'clear'):
1479 with repo.lock(): 1479 with repo.wlock():
1480 cache = getcache() 1480 cache = getcache()
1481 cache.clear(clear_persisted_data=True) 1481 cache.clear(clear_persisted_data=True)
1482 return 1482 return
1483 1483
1484 if add: 1484 if add:
1485 with repo.lock(): 1485 with repo.wlock():
1486 m = repo.manifestlog 1486 m = repo.manifestlog
1487 store = m.getstorage(b'') 1487 store = m.getstorage(b'')
1488 for n in add: 1488 for n in add:
1489 try: 1489 try:
1490 manifest = m[store.lookup(n)] 1490 manifest = m[store.lookup(n)]