comparison mercurial/branchmap.py @ 18218:d5655e742457

branchmap: drop `_cacheabletip` usage in `updatecache` Nobody overwrite the `_cacheabletip` any more. We always update the cache for the whole repo and write it to disk (or at list try to). The `updatecache` code is simplied to remove the double phase logic associated with _cacheabletip.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 04 Jan 2013 01:25:55 +0100
parents cd4c75200206
children dd0b636b0b65
comparison
equal deleted inserted replaced
18217:46cc3b74e1c5 18218:d5655e742457
66 if partial is None or not partial.validfor(repo): 66 if partial is None or not partial.validfor(repo):
67 partial = read(repo) 67 partial = read(repo)
68 if partial is None: 68 if partial is None:
69 partial = branchcache() 69 partial = branchcache()
70 70
71 catip = repo._cacheabletip() 71 revs = list(cl.revs(start=partial.tiprev +1))
72 # if partial.tiprev == catip: cache is already up to date 72 if revs:
73 # if partial.tiprev > catip: we have uncachable element in `partial` can't 73 ctxgen = (repo[r] for r in revs)
74 # write on disk
75 if partial.tiprev < catip:
76 ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, catip))
77 partial.update(repo, ctxgen) 74 partial.update(repo, ctxgen)
78 partial.write(repo) 75 partial.write(repo)
79 # If cacheable tip were lower than actual tip, we need to update the
80 # cache up to tip. This update (from cacheable to actual tip) is not
81 # written to disk since it's not cacheable.
82 tiprev = cl.rev(cl.tip())
83 if partial.tiprev < tiprev:
84 ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, tiprev))
85 partial.update(repo, ctxgen)
86 repo._branchcaches[repo.filtername] = partial 76 repo._branchcaches[repo.filtername] = partial
87 77
88 class branchcache(dict): 78 class branchcache(dict):
89 """A dict like object that hold branches heads cache""" 79 """A dict like object that hold branches heads cache"""
90 80