544 |
544 |
545 List which files in the working directory are matched by the |
545 List which files in the working directory are matched by the |
546 [keyword] configuration patterns. |
546 [keyword] configuration patterns. |
547 |
547 |
548 Useful to prevent inadvertent keyword expansion and to speed up |
548 Useful to prevent inadvertent keyword expansion and to speed up |
549 execution by including only files that are actual candidates |
549 execution by including only files that are actual candidates for |
550 for expansion. |
550 expansion. |
551 |
551 |
552 See "hg help keyword" on how to construct patterns both for |
552 See "hg help keyword" on how to construct patterns both for |
553 inclusion and exclusion of files. |
553 inclusion and exclusion of files. |
554 |
554 |
555 Use -u/--untracked to list untracked files as well. |
555 Use -u/--untracked to list untracked files as well. |
556 |
556 |
557 With -a/--all and -v/--verbose the codes used to show the status |
557 With -A/--all and -v/--verbose the codes used to show the status |
558 of files are: |
558 of files are: |
559 K = keyword expansion candidate |
559 K = keyword expansion candidate |
560 k = keyword expansion candidate (untracked) |
560 k = keyword expansion candidate (not tracked) |
561 I = ignored |
561 I = ignored |
562 i = ignored (untracked) |
562 i = ignored (not tracked) |
563 ''' |
563 ''' |
564 kwt = kwtools['templater'] |
564 kwt = kwtools['templater'] |
565 status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts) |
565 status = _status(ui, repo, kwt, *pats, **opts) |
|
566 cwd = pats and repo.getcwd() or '' |
566 modified, added, removed, deleted, unknown, ignored, clean = status |
567 modified, added, removed, deleted, unknown, ignored, clean = status |
567 try: |
568 files = [] |
568 # f67d1468ac50 |
569 if not opts.get('unknown') or ops.get('all'): |
569 files = util.sort(modified + added + clean) |
570 try: |
570 except AttributeError: |
571 # f67d1468ac50 |
571 files = modified + added + clean |
572 files = util.sort(modified + added + clean) |
572 files.sort() |
573 except AttributeError: |
|
574 files = modified + added + clean |
|
575 files.sort() |
573 try: |
576 try: |
574 # f6c00b17387c |
577 # f6c00b17387c |
575 wctx = repo[None] |
578 wctx = repo[None] |
576 except TypeError: |
579 except TypeError: |
577 wctx = repo.workingctx() |
580 wctx = repo.workingctx() |
581 islink = lambda p: 'l' in wctx.fileflags(p) |
584 islink = lambda p: 'l' in wctx.fileflags(p) |
582 else: |
585 else: |
583 mf = wctx.manifest() |
586 mf = wctx.manifest() |
584 islink = mf.linkf |
587 islink = mf.linkf |
585 kwfiles = [f for f in files if kwt.iskwfile(f, islink)] |
588 kwfiles = [f for f in files if kwt.iskwfile(f, islink)] |
586 kwuntracked = [f for f in unknown if kwt.iskwfile(f, islink)] |
589 kwunknown = [f for f in unknown if kwt.iskwfile(f, islink)] |
587 cwd = pats and repo.getcwd() or '' |
590 if not opts.get('ignore') or opts.get('all'): |
588 kwfstats = (not opts.get('ignore') and |
591 showfiles = kwfiles, kwunknown |
589 (('K', kwfiles), ('k', kwuntracked),) or ()) |
592 else: |
|
593 showfiles = [], [] |
590 if opts.get('all') or opts.get('ignore'): |
594 if opts.get('all') or opts.get('ignore'): |
591 kwfstats += (('I', [f for f in files if f not in kwfiles]), |
595 showfiles += ([f for f in files if f not in kwfiles], |
592 ('i', [f for f in unknown if f not in kwuntracked]),) |
596 [f for f in unknown if f not in kwunknown]) |
593 for char, filenames in kwfstats: |
597 for char, filenames in zip('KkIi', showfiles): |
594 fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n' |
598 fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n' |
595 for f in filenames: |
599 for f in filenames: |
596 ui.write(fmt % _pathto(repo, f, cwd)) |
600 ui.write(fmt % _pathto(repo, f, cwd)) |
597 |
601 |
598 def shrink(ui, repo, *pats, **opts): |
602 def shrink(ui, repo, *pats, **opts): |
812 _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP]...')), |
816 _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP]...')), |
813 'kwexpand': (expand, commands.walkopts, |
817 'kwexpand': (expand, commands.walkopts, |
814 _('hg kwexpand [OPTION]... [FILE]...')), |
818 _('hg kwexpand [OPTION]... [FILE]...')), |
815 'kwfiles': |
819 'kwfiles': |
816 (files, |
820 (files, |
817 [('a', 'all', None, _('show keyword status flags of all files')), |
821 [('A', 'all', None, _('show keyword status flags of all files')), |
818 ('i', 'ignore', None, _('show files excluded from expansion')), |
822 ('i', 'ignore', None, _('show files excluded from expansion')), |
819 ('u', 'untracked', None, _('additionally show untracked files')), |
823 ('u', 'unknown', None, _('only show unknown (not tracked) files')), |
820 ] + commands.walkopts, |
824 ] + commands.walkopts, |
821 _('hg kwfiles [OPTION]... [FILE]...')), |
825 _('hg kwfiles [OPTION]... [FILE]...')), |
822 'kwshrink': (shrink, commands.walkopts, |
826 'kwshrink': (shrink, commands.walkopts, |
823 _('hg kwshrink [OPTION]... [FILE]...')), |
827 _('hg kwshrink [OPTION]... [FILE]...')), |
824 } |
828 } |