comparison mercurial/commands.py @ 23762:0390cc327dd5

debugnamecomplete: rename from debuglabelcomplete Now that we have decided on the use of 'name' instead of 'label' we rename this function accordingly. The old method 'debuglabelcomplete' has been left as a deprecated command so that current scripts don't break.
author Sean Farley <sean.michael.farley@gmail.com>
date Fri, 17 Oct 2014 13:41:29 -0700
parents 3a4d8a6ce432
children 7ad155e13f0f
comparison
equal deleted inserted replaced
23761:19d6271a70db 23762:0390cc327dd5
2342 flags = repo.known([bin(s) for s in ids]) 2342 flags = repo.known([bin(s) for s in ids])
2343 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) 2343 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
2344 2344
2345 @command('debuglabelcomplete', [], _('LABEL...')) 2345 @command('debuglabelcomplete', [], _('LABEL...'))
2346 def debuglabelcomplete(ui, repo, *args): 2346 def debuglabelcomplete(ui, repo, *args):
2347 '''complete "labels" - tags, open branch names, bookmark names''' 2347 '''backwards compatibility with old bash completion scripts (DEPRECATED)'''
2348 2348 debugnamecomplete(ui, repo, *args)
2349 labels = set() 2349
2350 labels.update(t[0] for t in repo.tagslist()) 2350 @command('debugnamecomplete', [], _('NAME...'))
2351 labels.update(repo._bookmarks.keys()) 2351 def debugnamecomplete(ui, repo, *args):
2352 labels.update(tag for (tag, heads, tip, closed) 2352 '''complete "names" - tags, open branch names, bookmark names'''
2353 in repo.branchmap().iterbranches() if not closed) 2353
2354 names = set()
2355 names.update(t[0] for t in repo.tagslist())
2356 names.update(repo._bookmarks.keys())
2357 names.update(tag for (tag, heads, tip, closed)
2358 in repo.branchmap().iterbranches() if not closed)
2354 completions = set() 2359 completions = set()
2355 if not args: 2360 if not args:
2356 args = [''] 2361 args = ['']
2357 for a in args: 2362 for a in args:
2358 completions.update(l for l in labels if l.startswith(a)) 2363 completions.update(n for n in names if n.startswith(a))
2359 ui.write('\n'.join(sorted(completions))) 2364 ui.write('\n'.join(sorted(completions)))
2360 ui.write('\n') 2365 ui.write('\n')
2361 2366
2362 @command('debuglocks', 2367 @command('debuglocks',
2363 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), 2368 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),