Mercurial > public > mercurial-scm > hg
comparison mercurial/branchmap.py @ 24378:9347c15d8136
revbranchcache: write cache even during read operations
Previously we would only actually write the revbranchcache to disk if we were in
the middle of a write operation (like commit). Now we will also write it during
any read operation. The cache knows how to invalidate itself, so it shouldn't
become corrupt if multiple writers try at once (and the write-on-read
behavior/risk is the same as all our other caches).
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 24 Feb 2015 18:43:31 -0800 |
parents | 656f93ce66d5 |
children | 467a33142425 |
comparison
equal
deleted
inserted
replaced
24377:656f93ce66d5 | 24378:9347c15d8136 |
---|---|
95 revs.extend(cl.revs(start=partial.tiprev + 1)) | 95 revs.extend(cl.revs(start=partial.tiprev + 1)) |
96 if revs: | 96 if revs: |
97 partial.update(repo, revs) | 97 partial.update(repo, revs) |
98 partial.write(repo) | 98 partial.write(repo) |
99 | 99 |
100 if repo._revbranchcache is not None: | |
101 repo._revbranchcache.write() | |
102 | |
103 assert partial.validfor(repo), filtername | 100 assert partial.validfor(repo), filtername |
104 repo._branchcaches[repo.filtername] = partial | 101 repo._branchcaches[repo.filtername] = partial |
105 | 102 |
106 class branchcache(dict): | 103 class branchcache(dict): |
107 """A dict like object that hold branches heads cache. | 104 """A dict like object that hold branches heads cache. |