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.
--- 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