[PATCH 08 of 12] debuglabelcomplete: simplify with repo.branchmap().iterbranches()

Brodie Rao brodie at sf.io
Fri Nov 15 20:27:40 CST 2013


# HG changeset patch
# User Brodie Rao <brodie at sf.io>
# Date 1379318909 25200
#      Mon Sep 16 01:08:29 2013 -0700
# Node ID 0c14108b4c7ed4317b71f0f54b5bbc98a7c38558
# Parent  8b79a928000fbf6f28fd72a48b1b066721aaf3d7
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