Mercurial > hg-stable
changeset 30514:158b41842fd2
debugcommands: move 'debugcomplete' in the new module
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 17 Aug 2016 20:41:05 -0700 |
parents | c3bdc27121d1 |
children | d9d8d78e6bc9 |
files | mercurial/commands.py mercurial/debugcommands.py |
diffstat | 2 files changed, 28 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- 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')),
--- 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)))