##// END OF EJS Templates
branchmap: add some clarifications and clean up flow...
Martijn Pieters -
r41708:c795c462 default
parent child Browse files
Show More
@@ -44,22 +44,33 b" subsettable = {None: 'visible',"
44 44 'immutable': 'base'}
45 45
46 46 def updatecache(repo):
47 """Update the cache for the given filtered view on a repository"""
48 # This can trigger updates for the caches for subsets of the filtered
49 # view, e.g. when there is no cache for this filtered view or the cache
50 # is stale.
51
47 52 cl = repo.changelog
48 53 filtername = repo.filtername
49 54 bcache = repo._branchcaches.get(filtername)
55 if bcache is None or not bcache.validfor(repo):
56 # cache object missing or cache object stale? Read from disk
57 bcache = branchcache.fromfile(repo)
50 58
51 59 revs = []
52 if bcache is None or not bcache.validfor(repo):
53 bcache = branchcache.fromfile(repo)
54 if bcache is None:
55 subsetname = subsettable.get(filtername)
56 if subsetname is None:
57 bcache = branchcache()
58 else:
59 subset = repo.filtered(subsetname)
60 bcache = subset.branchmap().copy()
61 extrarevs = subset.changelog.filteredrevs - cl.filteredrevs
62 revs.extend(r for r in extrarevs if r <= bcache.tiprev)
60 if bcache is None:
61 # no (fresh) cache available anymore, perhaps we can re-use
62 # the cache for a subset, then extend that to add info on missing
63 # revisions.
64 subsetname = subsettable.get(filtername)
65 if subsetname is not None:
66 subset = repo.filtered(subsetname)
67 bcache = subset.branchmap().copy()
68 extrarevs = subset.changelog.filteredrevs - cl.filteredrevs
69 revs.extend(r for r in extrarevs if r <= bcache.tiprev)
70 else:
71 # nothing to fall back on, start empty.
72 bcache = branchcache()
73
63 74 revs.extend(cl.revs(start=bcache.tiprev + 1))
64 75 if revs:
65 76 bcache.update(repo, revs)
General Comments 0
You need to be logged in to leave comments. Login now