Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 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 | 9807e7d596c3 |
children | 5bb610f87d1d |
comparison
equal
deleted
inserted
replaced
18242:e4687edec014 | 18243:b3b1b8e127e5 |
---|---|
1404 limit = loglimit(opts) | 1404 limit = loglimit(opts) |
1405 # Default --rev value depends on --follow but --follow behaviour | 1405 # Default --rev value depends on --follow but --follow behaviour |
1406 # depends on revisions resolved from --rev... | 1406 # depends on revisions resolved from --rev... |
1407 follow = opts.get('follow') or opts.get('follow_first') | 1407 follow = opts.get('follow') or opts.get('follow_first') |
1408 possiblyunsorted = False # whether revs might need sorting | 1408 possiblyunsorted = False # whether revs might need sorting |
1409 if not opts.get('hidden'): | |
1410 repo = repo.filtered('hidden') | |
1409 if opts.get('rev'): | 1411 if opts.get('rev'): |
1410 revs = scmutil.revrange(repo, opts['rev']) | 1412 revs = scmutil.revrange(repo, opts['rev']) |
1411 # Don't sort here because _makegraphlogrevset might depend on the | 1413 # Don't sort here because _makegraphlogrevset might depend on the |
1412 # order of revs | 1414 # order of revs |
1413 possiblyunsorted = True | 1415 possiblyunsorted = True |
1430 # Revset matches can reorder revisions. "A or B" typically returns | 1432 # Revset matches can reorder revisions. "A or B" typically returns |
1431 # returns the revision matching A then the revision matching B. Sort | 1433 # returns the revision matching A then the revision matching B. Sort |
1432 # again to fix that. | 1434 # again to fix that. |
1433 revs = matcher(repo, revs) | 1435 revs = matcher(repo, revs) |
1434 revs.sort(reverse=True) | 1436 revs.sort(reverse=True) |
1435 if not opts.get('hidden'): | 1437 if limit is not None: |
1436 # --hidden is still experimental and not worth a dedicated revset | |
1437 # yet. Fortunately, filtering revision number is fast. | |
1438 hiddenrevs = repo.hiddenrevs | |
1439 nrevs = [] | |
1440 taken = 0 | |
1441 if limit is not None: | |
1442 for i in xrange(len(revs)): | |
1443 if taken >= limit: | |
1444 break | |
1445 r = revs[i] | |
1446 if r not in hiddenrevs: | |
1447 nrevs.append(r) | |
1448 taken += 1 | |
1449 revs = nrevs | |
1450 else: | |
1451 revs = [r for r in revs if r not in hiddenrevs] | |
1452 elif limit is not None: | |
1453 revs = revs[:limit] | 1438 revs = revs[:limit] |
1454 | 1439 |
1455 return revs, expr, filematcher | 1440 return revs, expr, filematcher |
1456 | 1441 |
1457 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None, | 1442 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None, |