comparison mercurial/debugcommands.py @ 30937:a9aa67ba3f96

debugcommands: move 'debugnamecomplete' in the new module
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 01 Feb 2017 17:41:12 +0100
parents 8de38479d60b
children 23c801570449
comparison
equal deleted inserted replaced
30936:8de38479d60b 30937:a9aa67ba3f96
1140 ui.note(('v1 and v2 states mismatch: using v1\n')) 1140 ui.note(('v1 and v2 states mismatch: using v1\n'))
1141 printrecords(1) 1141 printrecords(1)
1142 if ui.verbose: 1142 if ui.verbose:
1143 printrecords(2) 1143 printrecords(2)
1144 1144
1145 @command('debugnamecomplete', [], _('NAME...'))
1146 def debugnamecomplete(ui, repo, *args):
1147 '''complete "names" - tags, open branch names, bookmark names'''
1148
1149 names = set()
1150 # since we previously only listed open branches, we will handle that
1151 # specially (after this for loop)
1152 for name, ns in repo.names.iteritems():
1153 if name != 'branches':
1154 names.update(ns.listnames(repo))
1155 names.update(tag for (tag, heads, tip, closed)
1156 in repo.branchmap().iterbranches() if not closed)
1157 completions = set()
1158 if not args:
1159 args = ['']
1160 for a in args:
1161 completions.update(n for n in names if n.startswith(a))
1162 ui.write('\n'.join(sorted(completions)))
1163 ui.write('\n')
1164
1145 @command('debugupgraderepo', [ 1165 @command('debugupgraderepo', [
1146 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')), 1166 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
1147 ('', 'run', False, _('performs an upgrade')), 1167 ('', 'run', False, _('performs an upgrade')),
1148 ]) 1168 ])
1149 def debugupgraderepo(ui, repo, run=False, optimize=None): 1169 def debugupgraderepo(ui, repo, run=False, optimize=None):