Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/changelog.py (12 lines) | |||
M | mercurial/repoview.py (13 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
self._realopener = opener | self._realopener = opener | ||||
self._delayed = False | self._delayed = False | ||||
self._delaybuf = None | self._delaybuf = None | ||||
self._divert = False | self._divert = False | ||||
self.filteredrevs = frozenset() | self.filteredrevs = frozenset() | ||||
self._copiesstorage = opener.options.get(b'copies-storage') | self._copiesstorage = opener.options.get(b'copies-storage') | ||||
def __iter__(self): | |||||
"""filtered version of revlog.__iter__""" | |||||
if len(self.filteredrevs) == 0: | |||||
return revlog.revlog.__iter__(self) | |||||
def filterediter(): | |||||
for i in pycompat.xrange(len(self)): | |||||
if i not in self.filteredrevs: | |||||
yield i | |||||
return filterediter() | |||||
def revs(self, start=0, stop=None): | def revs(self, start=0, stop=None): | ||||
"""filtered version of revlog.revs""" | """filtered version of revlog.revs""" | ||||
for i in super(changelog, self).revs(start, stop): | for i in super(changelog, self).revs(start, stop): | ||||
if i not in self.filteredrevs: | if i not in self.filteredrevs: | ||||
yield i | yield i | ||||
def _checknofilteredinrevs(self, revs): | def _checknofilteredinrevs(self, revs): | ||||
"""raise the appropriate error if 'revs' contains a filtered revision | """raise the appropriate error if 'revs' contains a filtered revision |
delattr, | delattr, | ||||
getattr, | getattr, | ||||
setattr, | setattr, | ||||
) | ) | ||||
from . import ( | from . import ( | ||||
obsolete, | obsolete, | ||||
phases, | phases, | ||||
pycompat, | pycompat, | ||||
revlog, | |||||
tags as tagsmod, | tags as tagsmod, | ||||
util, | util, | ||||
) | ) | ||||
from .utils import repoviewutil | from .utils import repoviewutil | ||||
def hideablerevs(repo): | def hideablerevs(repo): | ||||
"""Revision candidates to be hidden | """Revision candidates to be hidden | ||||
for i in pycompat.xrange(len(self) - 1, -2, -1): | for i in pycompat.xrange(len(self) - 1, -2, -1): | ||||
if i not in self.filteredrevs: | if i not in self.filteredrevs: | ||||
return i | return i | ||||
def __contains__(self, rev): | def __contains__(self, rev): | ||||
"""filtered version of revlog.__contains__""" | """filtered version of revlog.__contains__""" | ||||
return 0 <= rev < len(self) and rev not in self.filteredrevs | return 0 <= rev < len(self) and rev not in self.filteredrevs | ||||
def __iter__(self): | |||||
"""filtered version of revlog.__iter__""" | |||||
if len(self.filteredrevs) == 0: | |||||
return revlog.revlog.__iter__(self) | |||||
def filterediter(): | |||||
for i in pycompat.xrange(len(self)): | |||||
if i not in self.filteredrevs: | |||||
yield i | |||||
return filterediter() | |||||
cl.__class__ = filteredchangelog | cl.__class__ = filteredchangelog | ||||
return cl | return cl | ||||
class repoview(object): | class repoview(object): | ||||
"""Provide a read/write view of a repo through a filtered changelog | """Provide a read/write view of a repo through a filtered changelog | ||||
This object is used to access a filtered version of a repository without | This object is used to access a filtered version of a repository without |