Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 47888:c094e829e848 stable
changelog: also monitor `00changelog.n` when applicable (issue6554)
This let the locarepo's file cache detect outdated nodemap docket and reload the
changelog after `localrepo.invalidate` when applicable.
Differential Revision: https://phab.mercurial-scm.org/D11482
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 21 Sep 2021 18:03:37 +0200 |
parents | 2813d406b036 |
children | 7970895a21cb |
comparison
equal
deleted
inserted
replaced
47887:52018f8ef020 | 47888:c094e829e848 |
---|---|
142 | 142 |
143 def join(self, obj, fname): | 143 def join(self, obj, fname): |
144 return obj.sjoin(fname) | 144 return obj.sjoin(fname) |
145 | 145 |
146 | 146 |
147 class changelogcache(storecache): | |
148 """filecache for the changelog""" | |
149 | |
150 def __init__(self): | |
151 super(changelogcache, self).__init__() | |
152 _cachedfiles.add((b'00changelog.i', b'')) | |
153 _cachedfiles.add((b'00changelog.n', b'')) | |
154 | |
155 def tracked_paths(self, obj): | |
156 paths = [self.join(obj, b'00changelog.i')] | |
157 if obj.store.opener.options.get(b'persistent-nodemap', False): | |
158 paths.append(self.join(obj, b'00changelog.n')) | |
159 return paths | |
160 | |
161 | |
147 class mixedrepostorecache(_basefilecache): | 162 class mixedrepostorecache(_basefilecache): |
148 """filecache for a mix files in .hg/store and outside""" | 163 """filecache for a mix files in .hg/store and outside""" |
149 | 164 |
150 def __init__(self, *pathsandlocations): | 165 def __init__(self, *pathsandlocations): |
151 # scmutil.filecache only uses the path for passing back into our | 166 # scmutil.filecache only uses the path for passing back into our |
1671 | 1686 |
1672 @storecache(b'obsstore') | 1687 @storecache(b'obsstore') |
1673 def obsstore(self): | 1688 def obsstore(self): |
1674 return obsolete.makestore(self.ui, self) | 1689 return obsolete.makestore(self.ui, self) |
1675 | 1690 |
1676 @storecache(b'00changelog.i') | 1691 @changelogcache() |
1677 def changelog(self): | 1692 def changelog(repo): |
1678 # load dirstate before changelog to avoid race see issue6303 | 1693 # load dirstate before changelog to avoid race see issue6303 |
1679 self.dirstate.prefetch_parents() | 1694 repo.dirstate.prefetch_parents() |
1680 return self.store.changelog( | 1695 return repo.store.changelog( |
1681 txnutil.mayhavepending(self.root), | 1696 txnutil.mayhavepending(repo.root), |
1682 concurrencychecker=revlogchecker.get_checker(self.ui, b'changelog'), | 1697 concurrencychecker=revlogchecker.get_checker(repo.ui, b'changelog'), |
1683 ) | 1698 ) |
1684 | 1699 |
1685 @storecache(b'00manifest.i') | 1700 @storecache(b'00manifest.i') |
1686 def manifestlog(self): | 1701 def manifestlog(self): |
1687 return self.store.manifestlog(self, self._storenarrowmatch) | 1702 return self.store.manifestlog(self, self._storenarrowmatch) |