314 are not tracked, or are links.''' |
314 are not tracked, or are links.''' |
315 files = man.keys() |
315 files = man.keys() |
316 if candidates: |
316 if candidates: |
317 return [f for f in candidates if kwfmatcher(f) |
317 return [f for f in candidates if kwfmatcher(f) |
318 and f in files and not man.linkf(f)] |
318 and f in files and not man.linkf(f)] |
319 # kwexpand w/o args on all files in manifest |
|
320 return [f for f in files if kwfmatcher(f) and not man.linkf(f)] |
319 return [f for f in files if kwfmatcher(f) and not man.linkf(f)] |
321 |
320 |
322 def _overwrite(ui, repo, files, expand): |
321 def _overwrite(ui, repo, files, expand): |
323 '''Expands/shrinks keywords in working directory.''' |
322 '''Expands/shrinks keywords in working directory.''' |
324 wlock = lock = None |
323 wlock = lock = None |
362 |
361 |
363 run after (re)enabling keyword expansion |
362 run after (re)enabling keyword expansion |
364 ''' |
363 ''' |
365 # 4th argument sets expansion to True |
364 # 4th argument sets expansion to True |
366 _overwrite(ui, repo, args, True) |
365 _overwrite(ui, repo, args, True) |
|
366 |
|
367 def files(ui, repo): |
|
368 '''print files currently configured for keyword expansion |
|
369 |
|
370 crosscheck which files are matched by [keyword] config patterns |
|
371 ''' |
|
372 kwfmatcher = _keywordmatcher(ui, repo) |
|
373 if kwfmatcher is not None: |
|
374 ctx = repo.changectx() |
|
375 files = _weedcandidates(ctx.manifest(), kwfmatcher, None) |
|
376 files.sort() |
|
377 ui.write('\n'.join(files) + '\n') |
367 |
378 |
368 def demo(ui, repo, *args, **opts): |
379 def demo(ui, repo, *args, **opts): |
369 '''print [keywordmaps] configuration and an expansion example |
380 '''print [keywordmaps] configuration and an expansion example |
370 |
381 |
371 show current, custom, or default keyword template maps and their expansion |
382 show current, custom, or default keyword template maps and their expansion |
524 'kwdemo': |
535 'kwdemo': |
525 (demo, |
536 (demo, |
526 [('d', 'default', None, _('show default keyword template maps')), |
537 [('d', 'default', None, _('show default keyword template maps')), |
527 ('f', 'rcfile', [], _('read maps from RCFILE'))], |
538 ('f', 'rcfile', [], _('read maps from RCFILE'))], |
528 _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP ...]')), |
539 _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP ...]')), |
|
540 'kwfiles': (files, [], _('hg kwfiles')), |
529 'kwshrink': (shrink, [], _('hg kwshrink [NAME] ...')), |
541 'kwshrink': (shrink, [], _('hg kwshrink [NAME] ...')), |
530 'kwexpand': (expand, [], _('hg kwexpand [NAME] ...')), |
542 'kwexpand': (expand, [], _('hg kwexpand [NAME] ...')), |
531 } |
543 } |