Patchwork D1492: repoview: take out the logic of computehidden to a new function

login
register
mail settings
Submitter phabricator
Date Nov. 23, 2017, 1:24 a.m.
Message ID <differential-rev-PHID-DREV-t6uuo5wjjnp2hn33pu4c-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25725/
State Superseded
Headers show

Comments

phabricator - Nov. 23, 2017, 1:24 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We are going to use that logic in compute functions for the new filternames
  which will be introduced in the next patch. So lets make a utility function
  which takes filtername and can be used by related compute functions.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/repoview.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 19, 2017, 12:22 p.m.
pulkit abandoned this revision.
pulkit added a comment.


  This series is superseded by https://phab.mercurial-scm.org/D1730 - https://phab.mercurial-scm.org/D1735.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -63,24 +63,27 @@ 
                 hidden.remove(p)
                 stack.append(p)
 
-def computehidden(repo):
-    """compute the set of hidden revision to filter
-
-    During most operation hidden should be filtered."""
-    assert not repo.changelog.filteredrevs
-
+def _computeperfiltername(repo, filtername):
+    """computes the set of revisions to filter for visible* filters"""
     hidden = hideablerevs(repo)
     if hidden:
         hidden = set(hidden - pinnedrevs(repo))
-        hidden = hidden - repo.filtered('visible').getvisibilityexceptions()
+        hidden = hidden - repo.filtered(filtername).getvisibilityexceptions()
         pfunc = repo.changelog.parentrevs
         mutablephases = (phases.draft, phases.secret)
         mutable = repo._phasecache.getrevset(repo, mutablephases)
 
         visible = mutable - hidden
         _revealancestors(pfunc, hidden, visible)
     return frozenset(hidden)
 
+def computehidden(repo):
+    """compute the set of hidden revision to filter
+
+    During most operation hidden should be filtered."""
+    assert not repo.changelog.filteredrevs
+    return _computeperfiltername(repo, 'visible')
+
 def computeunserved(repo):
     """compute the set of revision that should be filtered when used a server