[PATCH 09 of 13 V2] debuglabelcomplete: simplify with repo.branchmap().iterbranches()

Brodie Rao brodie at sf.io
Sat Nov 16 04:18:53 UTC 2013


# HG changeset patch
# User Brodie Rao <brodie at sf.io>
# Date 1379318909 25200
#      Mon Sep 16 01:08:29 2013 -0700
# Node ID 1774ee4b53e032815ae1d37a30f0d5a90a8a9f32
# Parent  d0b73a908d4aefd10bde5800d27316806de47f8e
debuglabelcomplete: simplify with repo.branchmap().iterbranches()

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2138,11 +2138,8 @@ def debuglabelcomplete(ui, repo, *args):
     labels = set()
     labels.update(t[0] for t in repo.tagslist())
     labels.update(repo._bookmarks.keys())
-    for heads in repo.branchmap().itervalues():
-        for h in heads:
-            ctx = repo[h]
-            if not ctx.closesbranch():
-                labels.add(ctx.branch())
+    labels.update(tag for (tag, heads, tip, closed)
+                  in repo.branchmap().iterbranches() if not closed)
     completions = set()
     if not args:
         args = ['']



More information about the Mercurial-devel mailing list