Show More
@@ -90,6 +90,9 b' import os, re, shutil, tempfile' | |||||
90 |
|
90 | |||
91 | commands.optionalrepo += ' kwdemo' |
|
91 | commands.optionalrepo += ' kwdemo' | |
92 |
|
92 | |||
|
93 | cmdtable = {} | |||
|
94 | command = cmdutil.command(cmdtable) | |||
|
95 | ||||
93 | # hg commands that do not act on keywords |
|
96 | # hg commands that do not act on keywords | |
94 | nokwcommands = ('add addremove annotate bundle export grep incoming init log' |
|
97 | nokwcommands = ('add addremove annotate bundle export grep incoming init log' | |
95 | ' outgoing push tip verify convert email glog') |
|
98 | ' outgoing push tip verify convert email glog') | |
@@ -345,6 +348,11 b' def _kwfwrite(ui, repo, expand, *pats, *' | |||||
345 | finally: |
|
348 | finally: | |
346 | wlock.release() |
|
349 | wlock.release() | |
347 |
|
350 | |||
|
351 | @command('kwdemo', | |||
|
352 | [('d', 'default', None, _('show default keyword template maps')), | |||
|
353 | ('f', 'rcfile', '', | |||
|
354 | _('read maps from rcfile'), _('FILE'))], | |||
|
355 | _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP]...')) | |||
348 | def demo(ui, repo, *args, **opts): |
|
356 | def demo(ui, repo, *args, **opts): | |
349 | '''print [keywordmaps] configuration and an expansion example |
|
357 | '''print [keywordmaps] configuration and an expansion example | |
350 |
|
358 | |||
@@ -428,6 +436,7 b' def demo(ui, repo, *args, **opts):' | |||||
428 | ui.write(repo.wread(fn)) |
|
436 | ui.write(repo.wread(fn)) | |
429 | shutil.rmtree(tmpdir, ignore_errors=True) |
|
437 | shutil.rmtree(tmpdir, ignore_errors=True) | |
430 |
|
438 | |||
|
439 | @command('kwexpand', commands.walkopts, _('hg kwexpand [OPTION]... [FILE]...')) | |||
431 | def expand(ui, repo, *pats, **opts): |
|
440 | def expand(ui, repo, *pats, **opts): | |
432 | '''expand keywords in the working directory |
|
441 | '''expand keywords in the working directory | |
433 |
|
442 | |||
@@ -438,6 +447,12 b' def expand(ui, repo, *pats, **opts):' | |||||
438 | # 3rd argument sets expansion to True |
|
447 | # 3rd argument sets expansion to True | |
439 | _kwfwrite(ui, repo, True, *pats, **opts) |
|
448 | _kwfwrite(ui, repo, True, *pats, **opts) | |
440 |
|
449 | |||
|
450 | @command('kwfiles', | |||
|
451 | [('A', 'all', None, _('show keyword status flags of all files')), | |||
|
452 | ('i', 'ignore', None, _('show files excluded from expansion')), | |||
|
453 | ('u', 'unknown', None, _('only show unknown (not tracked) files')), | |||
|
454 | ] + commands.walkopts, | |||
|
455 | _('hg kwfiles [OPTION]... [FILE]...')) | |||
441 | def files(ui, repo, *pats, **opts): |
|
456 | def files(ui, repo, *pats, **opts): | |
442 | '''show files configured for keyword expansion |
|
457 | '''show files configured for keyword expansion | |
443 |
|
458 | |||
@@ -484,6 +499,7 b' def files(ui, repo, *pats, **opts):' | |||||
484 | for f in filenames: |
|
499 | for f in filenames: | |
485 | ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate) |
|
500 | ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate) | |
486 |
|
501 | |||
|
502 | @command('kwshrink', commands.walkopts, _('hg kwshrink [OPTION]... [FILE]...')) | |||
487 | def shrink(ui, repo, *pats, **opts): |
|
503 | def shrink(ui, repo, *pats, **opts): | |
488 | '''revert expanded keywords in the working directory |
|
504 | '''revert expanded keywords in the working directory | |
489 |
|
505 | |||
@@ -673,23 +689,3 b' def reposetup(ui, repo):' | |||||
673 | pass |
|
689 | pass | |
674 |
|
690 | |||
675 | repo.__class__ = kwrepo |
|
691 | repo.__class__ = kwrepo | |
676 |
|
||||
677 | cmdtable = { |
|
|||
678 | 'kwdemo': |
|
|||
679 | (demo, |
|
|||
680 | [('d', 'default', None, _('show default keyword template maps')), |
|
|||
681 | ('f', 'rcfile', '', |
|
|||
682 | _('read maps from rcfile'), _('FILE'))], |
|
|||
683 | _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP]...')), |
|
|||
684 | 'kwexpand': (expand, commands.walkopts, |
|
|||
685 | _('hg kwexpand [OPTION]... [FILE]...')), |
|
|||
686 | 'kwfiles': |
|
|||
687 | (files, |
|
|||
688 | [('A', 'all', None, _('show keyword status flags of all files')), |
|
|||
689 | ('i', 'ignore', None, _('show files excluded from expansion')), |
|
|||
690 | ('u', 'unknown', None, _('only show unknown (not tracked) files')), |
|
|||
691 | ] + commands.walkopts, |
|
|||
692 | _('hg kwfiles [OPTION]... [FILE]...')), |
|
|||
693 | 'kwshrink': (shrink, commands.walkopts, |
|
|||
694 | _('hg kwshrink [OPTION]... [FILE]...')), |
|
|||
695 | } |
|
General Comments 0
You need to be logged in to leave comments.
Login now