# HG changeset patch # User Christian Ebert # Date 1267995036 -3600 # Node ID 19a327dfb68dab77bbb0090fbc9a4fb9ea2334b1 # Parent c23ba1aef69dca6d02f9e51432680c3309fec296 (0.9.2compat) upgrade kwfiles behaviour to match default wrt --unknown Switch long option name from --untracked to --unknown. diff -r c23ba1aef69d -r 19a327dfb68d hgkw/keyword.py --- a/hgkw/keyword.py Sun Mar 07 21:09:04 2010 +0100 +++ b/hgkw/keyword.py Sun Mar 07 21:50:36 2010 +0100 @@ -546,30 +546,33 @@ [keyword] configuration patterns. Useful to prevent inadvertent keyword expansion and to speed up - execution by including only files that are actual candidates - for expansion. + execution by including only files that are actual candidates for + expansion. See "hg help keyword" on how to construct patterns both for inclusion and exclusion of files. Use -u/--untracked to list untracked files as well. - With -a/--all and -v/--verbose the codes used to show the status + With -A/--all and -v/--verbose the codes used to show the status of files are: - K = keyword expansion candidate - k = keyword expansion candidate (untracked) - I = ignored - i = ignored (untracked) + K = keyword expansion candidate + k = keyword expansion candidate (not tracked) + I = ignored + i = ignored (not tracked) ''' kwt = kwtools['templater'] - status = _status(ui, repo, kwt, opts.get('untracked'), *pats, **opts) + status = _status(ui, repo, kwt, *pats, **opts) + cwd = pats and repo.getcwd() or '' modified, added, removed, deleted, unknown, ignored, clean = status - try: - # f67d1468ac50 - files = util.sort(modified + added + clean) - except AttributeError: - files = modified + added + clean - files.sort() + files = [] + if not opts.get('unknown') or ops.get('all'): + try: + # f67d1468ac50 + files = util.sort(modified + added + clean) + except AttributeError: + files = modified + added + clean + files.sort() try: # f6c00b17387c wctx = repo[None] @@ -583,14 +586,15 @@ mf = wctx.manifest() islink = mf.linkf kwfiles = [f for f in files if kwt.iskwfile(f, islink)] - kwuntracked = [f for f in unknown if kwt.iskwfile(f, islink)] - cwd = pats and repo.getcwd() or '' - kwfstats = (not opts.get('ignore') and - (('K', kwfiles), ('k', kwuntracked),) or ()) + kwunknown = [f for f in unknown if kwt.iskwfile(f, islink)] + if not opts.get('ignore') or opts.get('all'): + showfiles = kwfiles, kwunknown + else: + showfiles = [], [] if opts.get('all') or opts.get('ignore'): - kwfstats += (('I', [f for f in files if f not in kwfiles]), - ('i', [f for f in unknown if f not in kwuntracked]),) - for char, filenames in kwfstats: + showfiles += ([f for f in files if f not in kwfiles], + [f for f in unknown if f not in kwunknown]) + for char, filenames in zip('KkIi', showfiles): fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n' for f in filenames: ui.write(fmt % _pathto(repo, f, cwd)) @@ -814,9 +818,9 @@ _('hg kwexpand [OPTION]... [FILE]...')), 'kwfiles': (files, - [('a', 'all', None, _('show keyword status flags of all files')), + [('A', 'all', None, _('show keyword status flags of all files')), ('i', 'ignore', None, _('show files excluded from expansion')), - ('u', 'untracked', None, _('additionally show untracked files')), + ('u', 'unknown', None, _('only show unknown (not tracked) files')), ] + commands.walkopts, _('hg kwfiles [OPTION]... [FILE]...')), 'kwshrink': (shrink, commands.walkopts,