Show More
@@ -430,6 +430,9 b' class localrepository(object):' | |||
|
430 | 430 | # post-dirstate-status hooks |
|
431 | 431 | self._postdsstatus = [] |
|
432 | 432 | |
|
433 | # Cache of types representing filtered repos. | |
|
434 | self._filteredrepotypes = weakref.WeakKeyDictionary() | |
|
435 | ||
|
433 | 436 | # generic mapping between names and nodes |
|
434 | 437 | self.names = namespaces.namespaces() |
|
435 | 438 | |
@@ -539,11 +542,21 b' class localrepository(object):' | |||
|
539 | 542 | |
|
540 | 543 | def filtered(self, name): |
|
541 | 544 | """Return a filtered version of a repository""" |
|
542 | # build a new class with the mixin and the current class | |
|
543 | # (possibly subclass of the repo) | |
|
544 | class filteredrepo(repoview.repoview, self.unfiltered().__class__): | |
|
545 | pass | |
|
546 | return filteredrepo(self, name) | |
|
545 | # Python <3.4 easily leaks types via __mro__. See | |
|
546 | # https://bugs.python.org/issue17950. We cache dynamically | |
|
547 | # created types so this method doesn't leak on every | |
|
548 | # invocation. | |
|
549 | ||
|
550 | key = self.unfiltered().__class__ | |
|
551 | if key not in self._filteredrepotypes: | |
|
552 | # Build a new type with the repoview mixin and the base | |
|
553 | # class of this repo. Give it a name containing the | |
|
554 | # filter name to aid debugging. | |
|
555 | bases = (repoview.repoview, key) | |
|
556 | cls = type('%sfilteredrepo' % name, bases, {}) | |
|
557 | self._filteredrepotypes[key] = cls | |
|
558 | ||
|
559 | return self._filteredrepotypes[key](self, name) | |
|
547 | 560 | |
|
548 | 561 | @repofilecache('bookmarks', 'bookmarks.current') |
|
549 | 562 | def _bookmarks(self): |
@@ -165,6 +165,8 b' class statichttprepository(localrepo.loc' | |||
|
165 | 165 | self.encodepats = None |
|
166 | 166 | self.decodepats = None |
|
167 | 167 | self._transref = None |
|
168 | # Cache of types representing filtered repos. | |
|
169 | self._filteredrepotypes = {} | |
|
168 | 170 | |
|
169 | 171 | def _restrictcapabilities(self, caps): |
|
170 | 172 | caps = super(statichttprepository, self)._restrictcapabilities(caps) |
General Comments 0
You need to be logged in to leave comments.
Login now