comparison mercurial/commands.py @ 14466:bd34a027f3ed

commands: use repo.branchheads in heads command
author Martin Geisler <mg@aragost.com>
date Tue, 31 May 2011 13:18:56 +0200
parents 9e3a89c9e46c
children 610873cf064a
comparison
equal deleted inserted replaced
14465:9e3a89c9e46c 14466:bd34a027f3ed
2520 2520
2521 if opts.get('topo'): 2521 if opts.get('topo'):
2522 heads = [repo[h] for h in repo.heads(start)] 2522 heads = [repo[h] for h in repo.heads(start)]
2523 else: 2523 else:
2524 heads = [] 2524 heads = []
2525 for bheads in repo.branchmap().itervalues(): 2525 for branch in repo.branchmap():
2526 if start is None: 2526 heads += repo.branchheads(branch, start, opts.get('closed'))
2527 heads += [repo[h] for h in bheads] 2527 heads = [repo[h] for h in heads]
2528 continue
2529 startrev = repo.changelog.rev(start)
2530 descendants = set(repo.changelog.descendants(startrev))
2531 descendants.add(startrev)
2532 rev = repo.changelog.rev
2533 heads += [repo[h] for h in bheads if rev(h) in descendants]
2534 2528
2535 if branchrevs: 2529 if branchrevs:
2536 branches = set(repo[br].branch() for br in branchrevs) 2530 branches = set(repo[br].branch() for br in branchrevs)
2537 heads = [h for h in heads if h.branch() in branches] 2531 heads = [h for h in heads if h.branch() in branches]
2538
2539 if not opts.get('closed'):
2540 heads = [h for h in heads if not h.extra().get('close')]
2541 2532
2542 if opts.get('active') and branchrevs: 2533 if opts.get('active') and branchrevs:
2543 dagheads = repo.heads(start) 2534 dagheads = repo.heads(start)
2544 heads = [h for h in heads if h.node() in dagheads] 2535 heads = [h for h in heads if h.node() in dagheads]
2545 2536