D7257: [RFC] repoview: add a "filter" that just disallows walking to heads

2020-02-21 Thread baymax (Baymax, Your Personal Patch-care Companion)
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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7257: [RFC] repoview: add a "filter" that just disallows walking to heads

2019-11-13 Thread durin42 (Augie Fackler)
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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7257: [RFC] repoview: add a "filter" that just disallows walking to heads

2019-11-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In 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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7257: [RFC] repoview: add a "filter" that just disallows walking to heads

2019-11-12 Thread marmoute (Pierre-Yves David)
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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7257: [RFC] repoview: add a "filter" that just disallows walking to heads

2019-11-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 18048.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7257?vs=17625=18048

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7257/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7257

AFFECTED FILES
  mercurial/commands.py
  mercurial/repoview.py

CHANGE DETAILS

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -169,6 +169,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,
@@ -336,6 +337,24 @@
 return super(filteredchangelogmixin, self).flags(rev)
 
 
+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
 
@@ -404,8 +423,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, '_clcache', cl)
 object.__setattr__(self, '_clcachekey', newkey)
 return cl
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -174,7 +174,7 @@
 if not kwargs.get(b'rev') and not kwargs.get(b'change'):
 use_unfiltered = True
 
-return repo.unfiltered() if use_unfiltered else repo
+return repo.filtered(b'notreally') if use_unfiltered else repo
 
 
 # Commands start here, listed alphabetically



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7257: [RFC] repoview: add a "filter" that just disallows walking to heads

2019-11-06 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7257

AFFECTED FILES
  mercurial/commands.py
  mercurial/repoview.py

CHANGE DETAILS

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')



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel