changeset 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 f3b50431eb7e
files mercurial/commands.py
diffstat 1 files changed, 3 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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]