Show More
@@ -155,6 +155,8 b' class repoview(object):' | |||
|
155 | 155 | def __init__(self, repo, filtername): |
|
156 | 156 | object.__setattr__(self, '_unfilteredrepo', repo) |
|
157 | 157 | object.__setattr__(self, 'filtername', filtername) |
|
158 | object.__setattr__(self, '_clcachekey', None) | |
|
159 | object.__setattr__(self, '_clcache', None) | |
|
158 | 160 | |
|
159 | 161 | # not a cacheproperty on purpose we shall implement a proper cache later |
|
160 | 162 | @property |
@@ -163,8 +165,29 b' class repoview(object):' | |||
|
163 | 165 | |
|
164 | 166 | this changelog must not be used for writing""" |
|
165 | 167 | # some cache may be implemented later |
|
166 |
|
|
|
167 | cl.filteredrevs = filterrevs(self._unfilteredrepo, self.filtername) | |
|
168 | unfi = self._unfilteredrepo | |
|
169 | unfichangelog = unfi.changelog | |
|
170 | revs = filterrevs(unfi, self.filtername) | |
|
171 | cl = self._clcache | |
|
172 | newkey = (len(unfichangelog), unfichangelog.tip(), hash(revs)) | |
|
173 | if cl is not None: | |
|
174 | # we need to check curkey too for some obscure reason. | |
|
175 | # MQ test show a corruption of the underlying repo (in _clcache) | |
|
176 | # without change in the cachekey. | |
|
177 | oldfilter = cl.filteredrevs | |
|
178 | try: | |
|
179 | cl.filterrevs = () # disable filtering for tip | |
|
180 | curkey = (len(cl), cl.tip(), hash(oldfilter)) | |
|
181 | finally: | |
|
182 | cl.filteredrevs = oldfilter | |
|
183 | if newkey != self._clcachekey or newkey != curkey: | |
|
184 | cl = None | |
|
185 | # could have been made None by the previous if | |
|
186 | if cl is None: | |
|
187 | cl = copy.copy(unfichangelog) | |
|
188 | cl.filteredrevs = revs | |
|
189 | object.__setattr__(self, '_clcache', cl) | |
|
190 | object.__setattr__(self, '_clcachekey', newkey) | |
|
168 | 191 | return cl |
|
169 | 192 | |
|
170 | 193 | def unfiltered(self): |
General Comments 0
You need to be logged in to leave comments.
Login now