Skip to content
Snippets Groups Projects
Commit 3ad582b2895c authored by Pulkit Goyal's avatar Pulkit Goyal
Browse files

repoview: add visibilityexceptions as an optional argument to repo.filtered()

This will help us in having an API where we can pass the filtername and the
visibilityexceptions to get a new repo object.

Visibility exceptions are the revs which must be visible even they should in
theory belong to the hidden set. They are required as there has been desire to
have a functionality to access hidden changesets using certain commands without
passing --hidden. After this patch we can make those changesets visibility
exceptions so that we can access them without requiring a unfiltered repo.

Differential Revision: https://phab.mercurial-scm.org/D1746
parent ded3a63f305b
No related branches found
No related tags found
No related merge requests found
......@@ -675,6 +675,6 @@
Intended to be overwritten by filtered repo."""
return self
def filtered(self, name):
def filtered(self, name, visibilityexceptions=None):
"""Return a filtered version of a repository"""
cls = repoview.newtype(self.unfiltered().__class__)
......@@ -679,6 +679,6 @@
"""Return a filtered version of a repository"""
cls = repoview.newtype(self.unfiltered().__class__)
return cls(self, name)
return cls(self, name, visibilityexceptions)
@repofilecache('bookmarks', 'bookmarks.current')
def _bookmarks(self):
......
......@@ -187,8 +187,8 @@
subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
"""
def __init__(self, repo, filtername):
def __init__(self, repo, filtername, visibilityexceptions=None):
object.__setattr__(self, r'_unfilteredrepo', repo)
object.__setattr__(self, r'filtername', filtername)
object.__setattr__(self, r'_clcachekey', None)
object.__setattr__(self, r'_clcache', None)
......@@ -191,7 +191,10 @@
object.__setattr__(self, r'_unfilteredrepo', repo)
object.__setattr__(self, r'filtername', filtername)
object.__setattr__(self, r'_clcachekey', None)
object.__setattr__(self, r'_clcache', None)
# revs which are exceptions and must not be hidden
object.__setattr__(self, r'_visibilityexceptions',
visibilityexceptions)
# not a propertycache on purpose we shall implement a proper cache later
@property
......@@ -227,5 +230,5 @@
"""Return an unfiltered version of a repo"""
return self._unfilteredrepo
def filtered(self, name):
def filtered(self, name, visibilityexceptions=None):
"""Return a filtered version of a repository"""
......@@ -231,3 +234,3 @@
"""Return a filtered version of a repository"""
if name == self.filtername:
if name == self.filtername and not visibilityexceptions:
return self
......@@ -233,5 +236,5 @@
return self
return self.unfiltered().filtered(name)
return self.unfiltered().filtered(name, visibilityexceptions)
def __repr__(self):
return r'<%s:%s %r>' % (self.__class__.__name__,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment