##// END OF EJS Templates
keyword: use cmdutil.command decorator
Martin Geisler -
r14300:1b8e421d default
parent child Browse files
Show More
@@ -90,6 +90,9 b' import os, re, shutil, tempfile'
90 90
91 91 commands.optionalrepo += ' kwdemo'
92 92
93 cmdtable = {}
94 command = cmdutil.command(cmdtable)
95
93 96 # hg commands that do not act on keywords
94 97 nokwcommands = ('add addremove annotate bundle export grep incoming init log'
95 98 ' outgoing push tip verify convert email glog')
@@ -345,6 +348,11 b' def _kwfwrite(ui, repo, expand, *pats, *'
345 348 finally:
346 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 356 def demo(ui, repo, *args, **opts):
349 357 '''print [keywordmaps] configuration and an expansion example
350 358
@@ -428,6 +436,7 b' def demo(ui, repo, *args, **opts):'
428 436 ui.write(repo.wread(fn))
429 437 shutil.rmtree(tmpdir, ignore_errors=True)
430 438
439 @command('kwexpand', commands.walkopts, _('hg kwexpand [OPTION]... [FILE]...'))
431 440 def expand(ui, repo, *pats, **opts):
432 441 '''expand keywords in the working directory
433 442
@@ -438,6 +447,12 b' def expand(ui, repo, *pats, **opts):'
438 447 # 3rd argument sets expansion to True
439 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 456 def files(ui, repo, *pats, **opts):
442 457 '''show files configured for keyword expansion
443 458
@@ -484,6 +499,7 b' def files(ui, repo, *pats, **opts):'
484 499 for f in filenames:
485 500 ui.write(fmt % repo.pathto(f, cwd), label='kwfiles.' + kwstate)
486 501
502 @command('kwshrink', commands.walkopts, _('hg kwshrink [OPTION]... [FILE]...'))
487 503 def shrink(ui, repo, *pats, **opts):
488 504 '''revert expanded keywords in the working directory
489 505
@@ -673,23 +689,3 b' def reposetup(ui, repo):'
673 689 pass
674 690
675 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