comparison mercurial/commands.py @ 23763:7ad155e13f0f

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.
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 15 Dec 2014 14:11:19 -0800
parents 0390cc327dd5
children ff6b5b058fa0
comparison
equal deleted inserted replaced
23762:0390cc327dd5 23763:7ad155e13f0f
2350 @command('debugnamecomplete', [], _('NAME...')) 2350 @command('debugnamecomplete', [], _('NAME...'))
2351 def debugnamecomplete(ui, repo, *args): 2351 def debugnamecomplete(ui, repo, *args):
2352 '''complete "names" - tags, open branch names, bookmark names''' 2352 '''complete "names" - tags, open branch names, bookmark names'''
2353 2353
2354 names = set() 2354 names = set()
2355 names.update(t[0] for t in repo.tagslist()) 2355 # since we previously only listed open branches, we will handle that
2356 names.update(repo._bookmarks.keys()) 2356 # specially (after this for loop)
2357 for name, ns in repo.names.iteritems():
2358 if name != 'branches':
2359 names.update(ns.listnames(repo))
2357 names.update(tag for (tag, heads, tip, closed) 2360 names.update(tag for (tag, heads, tip, closed)
2358 in repo.branchmap().iterbranches() if not closed) 2361 in repo.branchmap().iterbranches() if not closed)
2359 completions = set() 2362 completions = set()
2360 if not args: 2363 if not args:
2361 args = [''] 2364 args = ['']