[PATCH] debuglabelcomplete: compute active branch heads correctly

Bryan O'Sullivan bos at serpentine.com
Mon Apr 8 14:49:03 CDT 2013


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1365450537 25200
#      Mon Apr 08 12:48:57 2013 -0700
# Node ID 279fb87a2621f2cfa347f8964b930db9cca48ce5
# Parent  565482e2ac6b71125e74adf409939bf54bad274f
debuglabelcomplete: compute active branch heads correctly

The previous computation was simply wrong.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2078,8 +2078,12 @@ def debuglabelcomplete(ui, repo, *args):
 
     labels = set()
     labels.update(t[0] for t in repo.tagslist())
-    labels.update(repo[n].branch() for n in repo.heads())
     labels.update(repo._bookmarks.keys())
+    for tag, heads in repo.branchmap().iteritems():
+        for h in heads:
+            ctx = repo[h]
+            if not ctx.closesbranch():
+                labels.add(ctx.branch())
     completions = set()
     if not args:
         args = ['']
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -329,8 +329,10 @@ Test debuglabelcomplete
   Fum
   default
   fee
+  fie
   fo
   tip
   $ hg debuglabelcomplete f
   fee
+  fie
   fo


More information about the Mercurial-devel mailing list