mercurial/debugcommands.py
changeset 30958 df73368c87c3
parent 30957 14794735faa8
child 30959 bd5694ce8beb
equal deleted inserted replaced
30957:14794735faa8 30958:df73368c87c3
  2023     rename some directories inside the ``.hg`` directory. On most machines, this
  2023     rename some directories inside the ``.hg`` directory. On most machines, this
  2024     should complete almost instantaneously and the chances of a consumer being
  2024     should complete almost instantaneously and the chances of a consumer being
  2025     unable to access the repository should be low.
  2025     unable to access the repository should be low.
  2026     """
  2026     """
  2027     return repair.upgraderepo(ui, repo, run=run, optimize=optimize)
  2027     return repair.upgraderepo(ui, repo, run=run, optimize=optimize)
       
  2028 
       
  2029 @command('debugwalk', commands.walkopts, _('[OPTION]... [FILE]...'),
       
  2030          inferrepo=True)
       
  2031 def debugwalk(ui, repo, *pats, **opts):
       
  2032     """show how files match on given patterns"""
       
  2033     m = scmutil.match(repo[None], pats, opts)
       
  2034     items = list(repo.walk(m))
       
  2035     if not items:
       
  2036         return
       
  2037     f = lambda fn: fn
       
  2038     if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
       
  2039         f = lambda fn: util.normpath(fn)
       
  2040     fmt = 'f  %%-%ds  %%-%ds  %%s' % (
       
  2041         max([len(abs) for abs in items]),
       
  2042         max([len(m.rel(abs)) for abs in items]))
       
  2043     for abs in items:
       
  2044         line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
       
  2045         ui.write("%s\n" % line.rstrip())