[PATCH 4 of 4] debugnamecomplete: use new name api

Sean Farley sean.michael.farley at gmail.com
Wed Jan 7 16:02:15 CST 2015


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1418681479 28800
#      Mon Dec 15 14:11:19 2014 -0800
# Node ID 015635d4fe8aa64420b99669df8284b5d7e10f1e
# Parent  45b4fd36ec5d9dc4c20a2f0b17c277d2c950e4fa
debugnamecomplete: use new name api

Instead of hardcoding a list of places to check, we use the new repo.names api
to get a list of potential names to complete.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2350,12 +2350,15 @@ def debuglabelcomplete(ui, repo, *args):
 @command('debugnamecomplete', [], _('NAME...'))
 def debugnamecomplete(ui, repo, *args):
     '''complete "names" - tags, open branch names, bookmark names'''
 
     names = set()
-    names.update(t[0] for t in repo.tagslist())
-    names.update(repo._bookmarks.keys())
+    # since we previously only listed open branches, we will handle that
+    # specially (after this for loop)
+    for name, ns in repo.names.iteritems():
+        if name != 'branches':
+            names.update(ns.listnames(repo))
     names.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