hgkw/keyword.py
changeset 270 371ce7fe5f13
parent 269 b5b64c9da876
child 271 35f43e2ce5b6
equal deleted inserted replaced
269:b5b64c9da876 270:371ce7fe5f13
   356     _overwrite(ui, repo, True, *pats, **opts)
   356     _overwrite(ui, repo, True, *pats, **opts)
   357 
   357 
   358 def files(ui, repo, *pats, **opts):
   358 def files(ui, repo, *pats, **opts):
   359     '''print files currently configured for keyword expansion
   359     '''print files currently configured for keyword expansion
   360 
   360 
   361     Crosscheck which files in working directory are target of expansion,
   361     Crosscheck which files in working directory are potential targets for
   362     that is, files matched by [keyword] config patterns but not symlinks.
   362     keyword expansion.
       
   363     That is, files matched by [keyword] config patterns but not symlinks.
   363     '''
   364     '''
   364     files, match, anypats = cmdutil.matchpats(repo, pats, opts)
   365     files, match, anypats = cmdutil.matchpats(repo, pats, opts)
   365     status = repo.status(files=files, match=match, list_clean=True)
   366     status = repo.status(files=files, match=match, list_clean=True)
   366     modified, added, removed, deleted, unknown, ignored, clean = status
   367     modified, added, removed, deleted, unknown, ignored, clean = status
   367     files = modified + added + clean
   368     if opts['untracked']:
       
   369         files = modified + added + unknown + clean
       
   370     else:
       
   371         files = modified + added + clean
   368     files.sort()
   372     files.sort()
   369     kwfiles = _weedfiles(ui, repo, files)
   373     kwfiles = _weedfiles(ui, repo, files)
   370     cwd = pats and repo.getcwd() or ''
   374     cwd = pats and repo.getcwd() or ''
   371     allf = opts['all']
   375     allf = opts['all']
   372     ignored = opts['ignored']
   376     ignore = opts['ignore']
   373     flag = (allf or ui.verbose) and 1 or 0
   377     flag = (allf or ui.verbose) and 1 or 0
   374     if not ignored:
   378     if not ignore:
   375         format = ('%s\n', 'K %s\n')[flag]
   379         format = ('%s\n', 'K %s\n')[flag]
   376         for k in kwfiles:
   380         for k in kwfiles:
   377             ui.write(format % _pathto(repo, cwd, k))
   381             ui.write(format % _pathto(repo, cwd, k))
   378     if allf or ignored:
   382     if allf or ignore:
   379         format = ('%s\n', 'I %s\n')[flag]
   383         format = ('%s\n', 'I %s\n')[flag]
   380         for i in [f for f in files if f not in kwfiles]:
   384         for i in [f for f in files if f not in kwfiles]:
   381             ui.write(format % _pathto(repo, cwd, i))
   385             ui.write(format % _pathto(repo, cwd, i))
   382 
   386 
   383 def demo(ui, repo, *args, **opts):
   387 def demo(ui, repo, *args, **opts):
   550          [('d', 'default', None, _('show default keyword template maps')),
   554          [('d', 'default', None, _('show default keyword template maps')),
   551           ('f', 'rcfile', [], _('read maps from RCFILE'))],
   555           ('f', 'rcfile', [], _('read maps from RCFILE'))],
   552          _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP ...]')),
   556          _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP ...]')),
   553     'kwfiles':
   557     'kwfiles':
   554         (files,
   558         (files,
   555          [('i', 'ignored', None, _('show files ignored by [keyword] patterns')),
   559          [('a', 'all', None, _('show keyword status flags of all files')),
   556           ('a', 'all', None, _('show keyword status flags of all files')),
   560           ('i', 'ignore', None, _('show files excluded from expansion')),
       
   561           ('u', 'untracked', None, _('additionally show untracked files')),
   557          ] + commands.walkopts,
   562          ] + commands.walkopts,
   558          _('hg kwfiles [OPTION]... [FILE]...')),
   563          _('hg kwfiles [OPTION]... [FILE]...')),
   559     'kwshrink': (shrink, commands.walkopts,
   564     'kwshrink': (shrink, commands.walkopts,
   560                  _('hg kwshrink [OPTION]... [FILE]...')),
   565                  _('hg kwshrink [OPTION]... [FILE]...')),
   561     'kwexpand': (expand, commands.walkopts,
   566     'kwexpand': (expand, commands.walkopts,