# HG changeset patch # User Pierre-Yves David # Date 2013-01-07 18:24:36 # Node ID b3b1b8e127e5122cf1104a2f0e7b6c6447839b5f # Parent e4687edec014cbc0cff47c178bb41560886f70b0 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. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1406,6 +1406,8 @@ def getgraphlogrevs(repo, pats, opts): # 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 @@ def getgraphlogrevs(repo, pats, opts): # 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