Patchwork [4,of,4] debugnamecomplete: use new name api

login
register
mail settings
Submitter Sean Farley
Date Jan. 7, 2015, 10:02 p.m.
Message ID <015635d4fe8aa64420b9.1420668135@laptop.local>
Download mbox | patch
Permalink /patch/7364/
State Accepted
Commit 7ad155e13f0f51df8e986a0ec4e58ac9a0ccedbb
Headers show

Comments

Sean Farley - Jan. 7, 2015, 10:02 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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.
Matt Mackall - Jan. 7, 2015, 10:41 p.m.
On Wed, 2015-01-07 at 14:02 -0800, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1418681479 28800
> #      Mon Dec 15 14:11:19 2014 -0800
> # Node ID 015635d4fe8aa64420b99669df8284b5d7e10f1e
> # Parent  45b4fd36ec5d9dc4c20a2f0b17c277d2c950e4fa
> debugnamecomplete: use new name api

These are queued for default, thanks.

Patch

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 = ['']