##// END OF EJS Templates
keyword: make kwfiles -u show untracked files only (like status)...
Christian Ebert -
r9493:fe1ecd15 default
parent child Browse files
Show More
@@ -382,8 +382,6 b' def files(ui, repo, *pats, **opts):'
382 382 See "hg help keyword" on how to construct patterns both for
383 383 inclusion and exclusion of files.
384 384
385 Use -u/--unknown to list unknown (not tracked) files as well.
386
387 385 With -a/--all and -v/--verbose the codes used to show the status
388 386 of files are::
389 387
@@ -394,18 +392,22 b' def files(ui, repo, *pats, **opts):'
394 392 '''
395 393 kwt = kwtools['templater']
396 394 status = _status(ui, repo, kwt, *pats, **opts)
395 cwd = pats and repo.getcwd() or ''
397 396 modified, added, removed, deleted, unknown, ignored, clean = status
398 files = sorted(modified + added + clean)
397 files = []
398 if not (opts.get('unknown') or opts.get('untracked')) or opts.get('all'):
399 files = sorted(modified + added + clean)
399 400 wctx = repo[None]
400 401 kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)]
401 402 kwunknown = [f for f in unknown if kwt.iskwfile(f, wctx.flags)]
402 cwd = pats and repo.getcwd() or ''
403 kwfstats = (not opts.get('ignore') and
404 (('K', kwfiles), ('k', kwunknown),) or ())
403 if not opts.get('ignore') or opts.get('all'):
404 showfiles = kwfiles, kwunknown
405 else:
406 showfiles = [], []
405 407 if opts.get('all') or opts.get('ignore'):
406 kwfstats += (('I', [f for f in files if f not in kwfiles]),
407 ('i', [f for f in unknown if f not in kwunknown]),)
408 for char, filenames in kwfstats:
408 showfiles += ([f for f in files if f not in kwfiles],
409 [f for f in unknown if f not in kwunknown])
410 for char, filenames in zip('KkIi', showfiles):
409 411 fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'
410 412 for f in filenames:
411 413 ui.write(fmt % repo.pathto(f, cwd))
@@ -549,10 +551,8 b' cmdtable = {'
549 551 (files,
550 552 [('a', 'all', None, _('show keyword status flags of all files')),
551 553 ('i', 'ignore', None, _('show files excluded from expansion')),
552 ('u', 'unknown', None,
553 _('additionally show unknown (not tracked) files')),
554 ('u', 'untracked', None,
555 _('additionally show untracked files (DEPRECATED)')),
554 ('u', 'unknown', None, _('only show unknown (not tracked) files')),
555 ('u', 'untracked', None, _('only show untracked files (DEPRECATED)')),
556 556 ] + commands.walkopts,
557 557 _('hg kwfiles [OPTION]... [FILE]...')),
558 558 'kwshrink': (shrink, commands.walkopts,
@@ -48,6 +48,11 b" echo 'ignore $Id$' > b"
48 48 echo % cat
49 49 cat a b
50 50
51 echo % no kwfiles
52 hg kwfiles
53 echo % untracked candidates
54 hg -v kwfiles --unknown
55
51 56 echo % addremove
52 57 hg addremove
53 58 echo % status
@@ -162,6 +167,10 b' hg status'
162 167
163 168 echo % kwfiles
164 169 hg kwfiles
170 echo % ignored files
171 hg -v kwfiles --ignore
172 echo % all files
173 hg kwfiles --all
165 174
166 175 echo % diff --rev
167 176 hg diff --rev 1 | grep -v 'b/c'
@@ -42,6 +42,9 b' expand $Id$'
42 42 do not process $Id:
43 43 xxx $
44 44 ignore $Id$
45 % no kwfiles
46 % untracked candidates
47 k a
45 48 % addremove
46 49 adding a
47 50 adding b
@@ -181,6 +184,14 b' xxx $'
181 184 % kwfiles
182 185 a
183 186 c
187 % ignored files
188 I b
189 I sym
190 % all files
191 K a
192 K c
193 I b
194 I sym
184 195 % diff --rev
185 196 diff -r ef63ca68695b c
186 197 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
General Comments 0
You need to be logged in to leave comments. Login now