Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 30957: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
30956:8de38479d60b | 30957:a9aa67ba3f96 |
---|---|
1860 Returns 0 on success, 1 if errors are encountered. | 1860 Returns 0 on success, 1 if errors are encountered. |
1861 """ | 1861 """ |
1862 with repo.wlock(False): | 1862 with repo.wlock(False): |
1863 return cmdutil.copy(ui, repo, pats, opts) | 1863 return cmdutil.copy(ui, repo, pats, opts) |
1864 | 1864 |
1865 @command('debugnamecomplete', [], _('NAME...')) | |
1866 def debugnamecomplete(ui, repo, *args): | |
1867 '''complete "names" - tags, open branch names, bookmark names''' | |
1868 | |
1869 names = set() | |
1870 # since we previously only listed open branches, we will handle that | |
1871 # specially (after this for loop) | |
1872 for name, ns in repo.names.iteritems(): | |
1873 if name != 'branches': | |
1874 names.update(ns.listnames(repo)) | |
1875 names.update(tag for (tag, heads, tip, closed) | |
1876 in repo.branchmap().iterbranches() if not closed) | |
1877 completions = set() | |
1878 if not args: | |
1879 args = [''] | |
1880 for a in args: | |
1881 completions.update(n for n in names if n.startswith(a)) | |
1882 ui.write('\n'.join(sorted(completions))) | |
1883 ui.write('\n') | |
1884 | |
1885 @command('debuglocks', | 1865 @command('debuglocks', |
1886 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), | 1866 [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), |
1887 ('W', 'force-wlock', None, | 1867 ('W', 'force-wlock', None, |
1888 _('free the working state lock (DANGEROUS)'))], | 1868 _('free the working state lock (DANGEROUS)'))], |
1889 _('[OPTION]...')) | 1869 _('[OPTION]...')) |