hgkw/keyword.py
changeset 596 2de4e2be005c
parent 595 1475f23ba334
child 597 795a95d7dc61
equal deleted inserted replaced
595:1475f23ba334 596:2de4e2be005c
   367     Useful to prevent inadvertent keyword expansion and to speed up
   367     Useful to prevent inadvertent keyword expansion and to speed up
   368     execution by including only filenames that are actual candidates
   368     execution by including only filenames that are actual candidates
   369     for expansion.
   369     for expansion.
   370 
   370 
   371     Use -u/--untracked to display untracked filenames as well.
   371     Use -u/--untracked to display untracked filenames as well.
       
   372 
       
   373     With -a/--all and -v/--verbose the codes used to show the status
       
   374     of files are:
       
   375     K = keyword expansion candidate
       
   376     k = keyword expansion candidate (untracked)
       
   377     I = ignored
       
   378     i = ignored (untracked)
   372     '''
   379     '''
   373     kwt = kwtools['templater']
   380     kwt = kwtools['templater']
   374     status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts)
   381     status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts)
   375     modified, added, removed, deleted, unknown, ignored, clean = status
   382     modified, added, removed, deleted, unknown, ignored, clean = status
   376     files = sorted(modified + added + clean + unknown)
   383     files = sorted(modified + added + clean)
   377     wctx = repo[None]
   384     wctx = repo[None]
   378     kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
   385     kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
       
   386     kwuntracked = [f for f in unknown if kwt.iskwfile(f, wctx.flags)]
   379     cwd = pats and repo.getcwd() or ''
   387     cwd = pats and repo.getcwd() or ''
   380     kwfstats = not opts.get('ignore') and (('K', kwfiles),) or ()
   388     kwfstats = (not opts.get('ignore') and
       
   389                 (('K', kwfiles), ('k', kwuntracked),) or ())
   381     if opts.get('all') or opts.get('ignore'):
   390     if opts.get('all') or opts.get('ignore'):
   382         kwfstats += (('I', [f for f in files if f not in kwfiles]),)
   391         kwfstats += (('I', [f for f in files if f not in kwfiles]),
       
   392                      ('i', [f for f in unknown if f not in kwuntracked]),)
   383     for char, filenames in kwfstats:
   393     for char, filenames in kwfstats:
   384         fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'
   394         fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'
   385         for f in filenames:
   395         for f in filenames:
   386             ui.write(fmt % repo.pathto(f, cwd))
   396             ui.write(fmt % repo.pathto(f, cwd))
   387 
   397