Submitter | phabricator |
---|---|
Date | Nov. 6, 2019, 5:04 p.m. |
Message ID | <differential-rev-PHID-DREV-rcfnraui63p6jrd4kvjj-req@mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/42807/ |
State | New |
Headers | show |
Comments
marmoute added a comment. Can you elaborate on what this changeset is about ? the description is a bit… short;-) REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7257/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7257 To: martinvonz, #hg-reviewers Cc: marmoute, mercurial-devel
martinvonz added a comment.
In D7257#108377 <https://phab.mercurial-scm.org/D7257#108377>, @marmoute wrote:
> Can you elaborate on what this changeset is about ? the description is a bit… short;-)
Done.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D7257/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D7257
To: martinvonz, #hg-reviewers
Cc: marmoute, mercurial-devel
durin42 added a comment. durin42 accepted this revision as: durin42. I'm a big fan of this idea. I'd probably land it if there were some obvious usecases as child patches. :) REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7257/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7257 To: martinvonz, #hg-reviewers, durin42 Cc: durin42, marmoute, mercurial-devel
This revision now requires changes to proceed. baymax added a comment. baymax requested changes to this revision. There seems to have been no activities on this Diff for the past 3 Months. By policy, we are automatically moving it out of the `need-review` state. Please, move it back to `need-review` without hesitation if this diff should still be discussed. :baymax:need-review-idle: REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7257/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7257 To: martinvonz, #hg-reviewers, durin42, baymax Cc: durin42, marmoute, mercurial-devel
Patch
diff --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -168,6 +168,7 @@ # Otherwise your filter will have to recompute all its branches cache # from scratch (very slow). filtertable = { + b'notreally': lambda repo, visibilityexceptions=None: frozenset(), b'visible': computehidden, b'visible-hidden': computehidden, b'served.hidden': computesecret, @@ -331,6 +332,24 @@ return cl +def poisonwalktoheads(unfichangelog): + cl = copy.copy(unfichangelog) + + def poison(*args, **kwargs): + raise error.ProgrammingError('called method on changelog that requries ' + 'filtering, but filtering was not requested') + + class filteredchangelog(cl.__class__): + tiprev = poison + headrevs = poison + __iter__ = poison + children = poison + + cl.__class__ = filteredchangelog + + return cl + + class repoview(object): """Provide a read/write view of a repo through a filtered changelog @@ -399,8 +418,13 @@ cl = None # could have been made None by the previous if if cl is None: - # Only filter if there's something to filter - cl = wrapchangelog(unfichangelog, revs) if revs else unfichangelog + if self.filtername == b'notreally': + cl = poisonwalktoheads(unfichangelog) + elif revs: + # Only filter if there's something to filter + cl = wrapchangelog(unfichangelog, revs) + else: + cl = unfichangelog object.__setattr__(self, r'_clcache', cl) object.__setattr__(self, r'_clcachekey', newkey) return cl diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -6793,7 +6793,7 @@ if not revs and not change: # Avoid loading obsmarkers if we're accessing only the working copy # parent (which will never be hidden). - repo = repo.unfiltered() + repo = repo.filtered(b'notreally') if revs and change: msg = _(b'cannot specify --rev and --change at the same time')