Mercurial > hg
comparison mercurial/manifest.py @ 41961:c3522b015f81
manifestcache: skip setup earlier if we don't have the lock
There a no point preparing a closure if we are not going to use it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 15 Mar 2019 09:07:23 +0000 |
parents | 876494fd967d |
children | 07c80298b5a1 |
comparison
equal
deleted
inserted
replaced
41960:7d417ab1eda9 | 41961:c3522b015f81 |
---|---|
1435 """Persist the manifestfulltextcache on lock release""" | 1435 """Persist the manifestfulltextcache on lock release""" |
1436 if not util.safehasattr(repo, '_lockref'): | 1436 if not util.safehasattr(repo, '_lockref'): |
1437 return | 1437 return |
1438 | 1438 |
1439 self._fulltextcache._opener = repo.cachevfs | 1439 self._fulltextcache._opener = repo.cachevfs |
1440 if repo._currentlock(repo._lockref) is None: | |
1441 return | |
1442 | |
1440 reporef = weakref.ref(repo) | 1443 reporef = weakref.ref(repo) |
1441 manifestrevlogref = weakref.ref(self) | 1444 manifestrevlogref = weakref.ref(self) |
1442 | 1445 |
1443 def persistmanifestcache(): | 1446 def persistmanifestcache(): |
1444 repo = reporef() | 1447 repo = reporef() |
1448 if repo.manifestlog.getstorage(b'') is not self: | 1451 if repo.manifestlog.getstorage(b'') is not self: |
1449 # there's a different manifest in play now, abort | 1452 # there's a different manifest in play now, abort |
1450 return | 1453 return |
1451 self._fulltextcache.write() | 1454 self._fulltextcache.write() |
1452 | 1455 |
1453 if repo._currentlock(repo._lockref) is not None: | 1456 repo._afterlock(persistmanifestcache) |
1454 repo._afterlock(persistmanifestcache) | |
1455 | 1457 |
1456 @property | 1458 @property |
1457 def fulltextcache(self): | 1459 def fulltextcache(self): |
1458 return self._fulltextcache | 1460 return self._fulltextcache |
1459 | 1461 |