Show More
@@ -44,22 +44,33 b" subsettable = {None: 'visible'," | |||||
44 | 'immutable': 'base'} |
|
44 | 'immutable': 'base'} | |
45 |
|
45 | |||
46 | def updatecache(repo): |
|
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 | cl = repo.changelog |
|
52 | cl = repo.changelog | |
48 | filtername = repo.filtername |
|
53 | filtername = repo.filtername | |
49 | bcache = repo._branchcaches.get(filtername) |
|
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 | revs = [] |
|
59 | revs = [] | |
52 |
if bcache is None |
|
60 | if bcache is None: | |
53 | bcache = branchcache.fromfile(repo) |
|
61 | # no (fresh) cache available anymore, perhaps we can re-use | |
54 | if bcache is None: |
|
62 | # the cache for a subset, then extend that to add info on missing | |
55 | subsetname = subsettable.get(filtername) |
|
63 | # revisions. | |
56 | if subsetname is None: |
|
64 | subsetname = subsettable.get(filtername) | |
57 | bcache = branchcache() |
|
65 | if subsetname is not None: | |
58 | else: |
|
66 | subset = repo.filtered(subsetname) | |
59 | subset = repo.filtered(subsetname) |
|
67 | bcache = subset.branchmap().copy() | |
60 | bcache = subset.branchmap().copy() |
|
68 | extrarevs = subset.changelog.filteredrevs - cl.filteredrevs | |
61 | extrarevs = subset.changelog.filteredrevs - cl.filteredrevs |
|
69 | revs.extend(r for r in extrarevs if r <= bcache.tiprev) | |
62 | 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 | revs.extend(cl.revs(start=bcache.tiprev + 1)) |
|
74 | revs.extend(cl.revs(start=bcache.tiprev + 1)) | |
64 | if revs: |
|
75 | if revs: | |
65 | bcache.update(repo, revs) |
|
76 | bcache.update(repo, revs) |
General Comments 0
You need to be logged in to leave comments.
Login now