changeset 18243:b3b1b8e127e5

log: use "hidden" filtering instead of manual check at display time When log is not given the --hidden option, hidden revision are not shown. We move the implementation from manual checking at display time to changelog filtering. This is the first official usage of the hidden filtering.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 07 Jan 2013 19:24:36 +0100
parents e4687edec014
children 5a3c71b0e042
files mercurial/cmdutil.py
diffstat 1 files changed, 3 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Jan 07 19:24:06 2013 +0100
+++ b/mercurial/cmdutil.py	Mon Jan 07 19:24:36 2013 +0100
@@ -1406,6 +1406,8 @@
     # depends on revisions resolved from --rev...
     follow = opts.get('follow') or opts.get('follow_first')
     possiblyunsorted = False # whether revs might need sorting
+    if not opts.get('hidden'):
+        repo = repo.filtered('hidden')
     if opts.get('rev'):
         revs = scmutil.revrange(repo, opts['rev'])
         # Don't sort here because _makegraphlogrevset might depend on the
@@ -1432,24 +1434,7 @@
         # again to fix that.
         revs = matcher(repo, revs)
         revs.sort(reverse=True)
-    if not opts.get('hidden'):
-        # --hidden is still experimental and not worth a dedicated revset
-        # yet. Fortunately, filtering revision number is fast.
-        hiddenrevs = repo.hiddenrevs
-        nrevs = []
-        taken = 0
-        if limit is not None:
-            for i in xrange(len(revs)):
-                if taken >= limit:
-                    break
-                r = revs[i]
-                if r not in hiddenrevs:
-                    nrevs.append(r)
-                    taken += 1
-            revs = nrevs
-        else:
-            revs = [r for r in revs if r not in hiddenrevs]
-    elif limit is not None:
+    if limit is not None:
         revs = revs[:limit]
 
     return revs, expr, filematcher