commands: actually implement --closed for topological heads
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Sat, 06 Feb 2010 19:33:40 +0100
changeset 10349 20356e69710c
parent 10348 0fc5222c0951
child 10350 fd511e9eeea6
commands: actually implement --closed for topological heads
mercurial/commands.py
tests/test-branches.out
--- a/mercurial/commands.py	Sat Feb 06 19:06:02 2010 +0100
+++ b/mercurial/commands.py	Sat Feb 06 19:33:40 2010 +0100
@@ -1436,13 +1436,14 @@
             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')]
-
-        if opts.get('active'):
-            dagheads = repo.heads(start)
-            heads = [h for h in heads if h in dagheads]
-
+    if not opts.get('closed'):
+        heads = [h for h in heads if not repo[h].extra().get('close')]
+
+    if opts.get('active') and branchrevs:
+        dagheads = repo.heads(start)
+        heads = [h for h in heads if h in dagheads]
+
+    if branchrevs:
         haveheads = set(repo[h].branch() for h in heads)
         if branches - haveheads:
             headless = ', '.join(encode(b) for b in branches - haveheads)
--- a/tests/test-branches.out	Sat Feb 06 19:06:02 2010 +0100
+++ b/tests/test-branches.out	Sat Feb 06 19:33:40 2010 +0100
@@ -143,12 +143,6 @@
 date:        Thu Jan 01 00:00:09 1970 +0000
 summary:     reopen branch with a change
 
-changeset:   11:c84627f3c15d
-branch:      b
-user:        test
-date:        Thu Jan 01 00:00:09 1970 +0000
-summary:     prune bad branch
-
 changeset:   7:10ff5895aa57
 branch:      a branch name much longer than the default justification used by branches
 user:        test