Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 30978:df73368c87c3
debugcommands: move 'debugwalk' in the new module
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 02 Feb 2017 10:07:28 +0100 |
parents | 14794735faa8 |
children | bd5694ce8beb |
comparison
equal
deleted
inserted
replaced
30977:14794735faa8 | 30978:df73368c87c3 |
---|---|
1850 Returns 0 on success, 1 if errors are encountered. | 1850 Returns 0 on success, 1 if errors are encountered. |
1851 """ | 1851 """ |
1852 with repo.wlock(False): | 1852 with repo.wlock(False): |
1853 return cmdutil.copy(ui, repo, pats, opts) | 1853 return cmdutil.copy(ui, repo, pats, opts) |
1854 | 1854 |
1855 | |
1856 @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'), inferrepo=True) | |
1857 def debugwalk(ui, repo, *pats, **opts): | |
1858 """show how files match on given patterns""" | |
1859 m = scmutil.match(repo[None], pats, opts) | |
1860 items = list(repo.walk(m)) | |
1861 if not items: | |
1862 return | |
1863 f = lambda fn: fn | |
1864 if ui.configbool('ui', 'slash') and pycompat.ossep != '/': | |
1865 f = lambda fn: util.normpath(fn) | |
1866 fmt = 'f %%-%ds %%-%ds %%s' % ( | |
1867 max([len(abs) for abs in items]), | |
1868 max([len(m.rel(abs)) for abs in items])) | |
1869 for abs in items: | |
1870 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') | |
1871 ui.write("%s\n" % line.rstrip()) | |
1872 | |
1873 @command('debugwireargs', | 1855 @command('debugwireargs', |
1874 [('', 'three', '', 'three'), | 1856 [('', 'three', '', 'three'), |
1875 ('', 'four', '', 'four'), | 1857 ('', 'four', '', 'four'), |
1876 ('', 'five', '', 'five'), | 1858 ('', 'five', '', 'five'), |
1877 ] + remoteopts, | 1859 ] + remoteopts, |