Mercurial > hg
comparison mercurial/commands.py @ 30505: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 |
comparison
equal
deleted
inserted
replaced
30504:c3bdc27121d1 | 30505:158b41842fd2 |
---|---|
1865 Returns 0 on success, 1 if errors are encountered. | 1865 Returns 0 on success, 1 if errors are encountered. |
1866 """ | 1866 """ |
1867 with repo.wlock(False): | 1867 with repo.wlock(False): |
1868 return cmdutil.copy(ui, repo, pats, opts) | 1868 return cmdutil.copy(ui, repo, pats, opts) |
1869 | 1869 |
1870 @command('debugcomplete', | |
1871 [('o', 'options', None, _('show the command options'))], | |
1872 _('[-o] CMD'), | |
1873 norepo=True) | |
1874 def debugcomplete(ui, cmd='', **opts): | |
1875 """returns the completion list associated with the given command""" | |
1876 | |
1877 if opts.get('options'): | |
1878 options = [] | |
1879 otables = [globalopts] | |
1880 if cmd: | |
1881 aliases, entry = cmdutil.findcmd(cmd, table, False) | |
1882 otables.append(entry[1]) | |
1883 for t in otables: | |
1884 for o in t: | |
1885 if "(DEPRECATED)" in o[3]: | |
1886 continue | |
1887 if o[0]: | |
1888 options.append('-%s' % o[0]) | |
1889 options.append('--%s' % o[1]) | |
1890 ui.write("%s\n" % "\n".join(options)) | |
1891 return | |
1892 | |
1893 cmdlist, unused_allcmds = cmdutil.findpossible(cmd, table) | |
1894 if ui.verbose: | |
1895 cmdlist = [' '.join(c[0]) for c in cmdlist.values()] | |
1896 ui.write("%s\n" % "\n".join(sorted(cmdlist))) | |
1897 | |
1898 @command('debugdag', | 1870 @command('debugdag', |
1899 [('t', 'tags', None, _('use tags as labels')), | 1871 [('t', 'tags', None, _('use tags as labels')), |
1900 ('b', 'branches', None, _('annotate with branch names')), | 1872 ('b', 'branches', None, _('annotate with branch names')), |
1901 ('', 'dots', None, _('use dots for runs')), | 1873 ('', 'dots', None, _('use dots for runs')), |
1902 ('s', 'spaces', None, _('separate elements by spaces'))], | 1874 ('s', 'spaces', None, _('separate elements by spaces'))], |