# HG changeset patch # User Martin Geisler # Date 1306840736 -7200 # Node ID bd34a027f3edad33e71c02def67eb446473b6cf4 # Parent 9e3a89c9e46cb1553451332ea8c71f9829b95b62 commands: use repo.branchheads in heads command diff -r 9e3a89c9e46c -r bd34a027f3ed mercurial/commands.py --- a/mercurial/commands.py Tue May 31 09:59:03 2011 +0200 +++ b/mercurial/commands.py Tue May 31 13:18:56 2011 +0200 @@ -2522,23 +2522,14 @@ heads = [repo[h] for h in repo.heads(start)] else: heads = [] - for bheads in repo.branchmap().itervalues(): - if start is None: - heads += [repo[h] for h in bheads] - continue - startrev = repo.changelog.rev(start) - descendants = set(repo.changelog.descendants(startrev)) - descendants.add(startrev) - rev = repo.changelog.rev - heads += [repo[h] for h in bheads if rev(h) in descendants] + for branch in repo.branchmap(): + heads += repo.branchheads(branch, start, opts.get('closed')) + heads = [repo[h] for h in heads] if branchrevs: branches = set(repo[br].branch() for br in branchrevs) heads = [h for h in heads if h.branch() in branches] - if not opts.get('closed'): - heads = [h for h in heads if not h.extra().get('close')] - if opts.get('active') and branchrevs: dagheads = repo.heads(start) heads = [h for h in heads if h.node() in dagheads]