# HG changeset patch # User Gregory Szorc # Date 1471491665 25200 # Node ID 158b41842fd2ffa599e568f42c88934bc3276ea8 # Parent c3bdc27121d16fd0c19ac25f2ed21dcbd0dc5853 debugcommands: move 'debugcomplete' in the new module diff -r c3bdc27121d1 -r 158b41842fd2 mercurial/commands.py --- a/mercurial/commands.py Wed Aug 17 20:40:13 2016 -0700 +++ b/mercurial/commands.py Wed Aug 17 20:41:05 2016 -0700 @@ -1867,34 +1867,6 @@ with repo.wlock(False): return cmdutil.copy(ui, repo, pats, opts) -@command('debugcomplete', - [('o', 'options', None, _('show the command options'))], - _('[-o] CMD'), - norepo=True) -def debugcomplete(ui, cmd='', **opts): - """returns the completion list associated with the given command""" - - if opts.get('options'): - options = [] - otables = [globalopts] - if cmd: - aliases, entry = cmdutil.findcmd(cmd, table, False) - otables.append(entry[1]) - for t in otables: - for o in t: - if "(DEPRECATED)" in o[3]: - continue - if o[0]: - options.append('-%s' % o[0]) - options.append('--%s' % o[1]) - ui.write("%s\n" % "\n".join(options)) - return - - cmdlist, unused_allcmds = cmdutil.findpossible(cmd, table) - if ui.verbose: - cmdlist = [' '.join(c[0]) for c in cmdlist.values()] - ui.write("%s\n" % "\n".join(sorted(cmdlist))) - @command('debugdag', [('t', 'tags', None, _('use tags as labels')), ('b', 'branches', None, _('annotate with branch names')), diff -r c3bdc27121d1 -r 158b41842fd2 mercurial/debugcommands.py --- a/mercurial/debugcommands.py Wed Aug 17 20:40:13 2016 -0700 +++ b/mercurial/debugcommands.py Wed Aug 17 20:41:05 2016 -0700 @@ -329,3 +329,31 @@ cmd = cmd.split('|')[0].strip('^') opts = ', '.join([i[1] for i in vals[1]]) ui.write('%s: %s\n' % (cmd, opts)) + +@command('debugcomplete', + [('o', 'options', None, _('show the command options'))], + _('[-o] CMD'), + norepo=True) +def debugcomplete(ui, cmd='', **opts): + """returns the completion list associated with the given command""" + + if opts.get('options'): + options = [] + otables = [commands.globalopts] + if cmd: + aliases, entry = cmdutil.findcmd(cmd, commands.table, False) + otables.append(entry[1]) + for t in otables: + for o in t: + if "(DEPRECATED)" in o[3]: + continue + if o[0]: + options.append('-%s' % o[0]) + options.append('--%s' % o[1]) + ui.write("%s\n" % "\n".join(options)) + return + + cmdlist, unused_allcmds = cmdutil.findpossible(cmd, commands.table) + if ui.verbose: + cmdlist = [' '.join(c[0]) for c in cmdlist.values()] + ui.write("%s\n" % "\n".join(sorted(cmdlist)))