mercurial/repoview.py
changeset 43506 9f70512ae2cf
parent 43492 bad4a26b4607
child 43510 85628a595c37
equal deleted inserted replaced
43505:47fac1692ede 43506:9f70512ae2cf
   368     The inheritance has to be done dynamically because `repo` can be of any
   368     The inheritance has to be done dynamically because `repo` can be of any
   369     subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
   369     subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
   370     """
   370     """
   371 
   371 
   372     def __init__(self, repo, filtername, visibilityexceptions=None):
   372     def __init__(self, repo, filtername, visibilityexceptions=None):
   373         object.__setattr__(self, r'_unfilteredrepo', repo)
   373         object.__setattr__(self, '_unfilteredrepo', repo)
   374         object.__setattr__(self, r'filtername', filtername)
   374         object.__setattr__(self, 'filtername', filtername)
   375         object.__setattr__(self, r'_clcachekey', None)
   375         object.__setattr__(self, '_clcachekey', None)
   376         object.__setattr__(self, r'_clcache', None)
   376         object.__setattr__(self, '_clcache', None)
   377         # revs which are exceptions and must not be hidden
   377         # revs which are exceptions and must not be hidden
   378         object.__setattr__(self, r'_visibilityexceptions', visibilityexceptions)
   378         object.__setattr__(self, '_visibilityexceptions', visibilityexceptions)
   379 
   379 
   380     # not a propertycache on purpose we shall implement a proper cache later
   380     # not a propertycache on purpose we shall implement a proper cache later
   381     @property
   381     @property
   382     def changelog(self):
   382     def changelog(self):
   383         """return a filtered version of the changeset
   383         """return a filtered version of the changeset
   402             cl = None
   402             cl = None
   403         # could have been made None by the previous if
   403         # could have been made None by the previous if
   404         if cl is None:
   404         if cl is None:
   405             # Only filter if there's something to filter
   405             # Only filter if there's something to filter
   406             cl = wrapchangelog(unfichangelog, revs) if revs else unfichangelog
   406             cl = wrapchangelog(unfichangelog, revs) if revs else unfichangelog
   407             object.__setattr__(self, r'_clcache', cl)
   407             object.__setattr__(self, '_clcache', cl)
   408             object.__setattr__(self, r'_clcachekey', newkey)
   408             object.__setattr__(self, '_clcachekey', newkey)
   409         return cl
   409         return cl
   410 
   410 
   411     def unfiltered(self):
   411     def unfiltered(self):
   412         """Return an unfiltered version of a repo"""
   412         """Return an unfiltered version of a repo"""
   413         return self._unfilteredrepo
   413         return self._unfilteredrepo
   417         if name == self.filtername and not visibilityexceptions:
   417         if name == self.filtername and not visibilityexceptions:
   418             return self
   418             return self
   419         return self.unfiltered().filtered(name, visibilityexceptions)
   419         return self.unfiltered().filtered(name, visibilityexceptions)
   420 
   420 
   421     def __repr__(self):
   421     def __repr__(self):
   422         return r'<%s:%s %r>' % (
   422         return '<%s:%s %r>' % (
   423             self.__class__.__name__,
   423             self.__class__.__name__,
   424             pycompat.sysstr(self.filtername),
   424             pycompat.sysstr(self.filtername),
   425             self.unfiltered(),
   425             self.unfiltered(),
   426         )
   426         )
   427 
   427