##// END OF EJS Templates
repoview: add visibilityexceptions as an optional argument to repo.filtered()...
Pulkit Goyal -
r35508:3ad582b2 default
parent child Browse files
Show More
@@ -675,10 +675,10 class localrepository(object):
675 Intended to be overwritten by filtered repo."""
675 Intended to be overwritten by filtered repo."""
676 return self
676 return self
677
677
678 def filtered(self, name):
678 def filtered(self, name, visibilityexceptions=None):
679 """Return a filtered version of a repository"""
679 """Return a filtered version of a repository"""
680 cls = repoview.newtype(self.unfiltered().__class__)
680 cls = repoview.newtype(self.unfiltered().__class__)
681 return cls(self, name)
681 return cls(self, name, visibilityexceptions)
682
682
683 @repofilecache('bookmarks', 'bookmarks.current')
683 @repofilecache('bookmarks', 'bookmarks.current')
684 def _bookmarks(self):
684 def _bookmarks(self):
@@ -187,11 +187,14 class repoview(object):
187 subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
187 subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
188 """
188 """
189
189
190 def __init__(self, repo, filtername):
190 def __init__(self, repo, filtername, visibilityexceptions=None):
191 object.__setattr__(self, r'_unfilteredrepo', repo)
191 object.__setattr__(self, r'_unfilteredrepo', repo)
192 object.__setattr__(self, r'filtername', filtername)
192 object.__setattr__(self, r'filtername', filtername)
193 object.__setattr__(self, r'_clcachekey', None)
193 object.__setattr__(self, r'_clcachekey', None)
194 object.__setattr__(self, r'_clcache', None)
194 object.__setattr__(self, r'_clcache', None)
195 # revs which are exceptions and must not be hidden
196 object.__setattr__(self, r'_visibilityexceptions',
197 visibilityexceptions)
195
198
196 # not a propertycache on purpose we shall implement a proper cache later
199 # not a propertycache on purpose we shall implement a proper cache later
197 @property
200 @property
@@ -227,11 +230,11 class repoview(object):
227 """Return an unfiltered version of a repo"""
230 """Return an unfiltered version of a repo"""
228 return self._unfilteredrepo
231 return self._unfilteredrepo
229
232
230 def filtered(self, name):
233 def filtered(self, name, visibilityexceptions=None):
231 """Return a filtered version of a repository"""
234 """Return a filtered version of a repository"""
232 if name == self.filtername:
235 if name == self.filtername and not visibilityexceptions:
233 return self
236 return self
234 return self.unfiltered().filtered(name)
237 return self.unfiltered().filtered(name, visibilityexceptions)
235
238
236 def __repr__(self):
239 def __repr__(self):
237 return r'<%s:%s %r>' % (self.__class__.__name__,
240 return r'<%s:%s %r>' % (self.__class__.__name__,
General Comments 0
You need to be logged in to leave comments. Login now