changeset 10348:0fc5222c0951

commands: externalize branchheads so we can do it for all branches at once
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Sat, 06 Feb 2010 19:06:02 +0100
parents 7516716e56dc
children 20356e69710c
files mercurial/commands.py
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Feb 06 19:33:33 2010 +0100
+++ b/mercurial/commands.py	Sat Feb 06 19:06:02 2010 +0100
@@ -1423,12 +1423,18 @@
     else:
 
         decode, encode = encoding.fromlocal, encoding.tolocal
+        heads = []
         branches = set(repo[decode(br)].branch() for br in branchrevs)
-        heads = []
-
-        for b in branches:
-            bheads = repo.branchheads(b, start, True)
-            heads.extend(bheads)
+        for b, ls in repo.branchmap().iteritems():
+            if b not in branches:
+                continue
+            if start is None:
+                heads += ls
+                continue
+            startrev = repo.changelog.rev(start)
+            descendants = set(repo.changelog.descendants(startrev))
+            descendants.add(startrev)
+            heads += [h for h in ls if repo.changelog.rev(h) in descendants]
 
         if not opts.get('closed'):
             heads = [h for h in heads if not repo[h].extra().get('close')]