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