commands: use repo.branchheads in heads command
authorMartin Geisler <mg@aragost.com>
Tue, 31 May 2011 13:18:56 +0200
changeset 14466 bd34a027f3ed
parent 14465 9e3a89c9e46c
child 14467 f3b50431eb7e
commands: use repo.branchheads in heads command
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]