Mercurial > hg
comparison hgext/keyword.py @ 32375:04baab18d60a
commands: move templates of common command options to cmdutil (API)
The goal is to get rid of the debugcommands -> commands dependency.
Since globalopts is the property of the commands, it's kept in the commands
module.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 14 May 2017 16:19:47 +0900 |
parents | 46ba2cdda476 |
children | 50586a0a946f |
comparison
equal
deleted
inserted
replaced
32374:194b0f781132 | 32375:04baab18d60a |
---|---|
92 from mercurial.i18n import _ | 92 from mercurial.i18n import _ |
93 from mercurial.hgweb import webcommands | 93 from mercurial.hgweb import webcommands |
94 | 94 |
95 from mercurial import ( | 95 from mercurial import ( |
96 cmdutil, | 96 cmdutil, |
97 commands, | |
98 context, | 97 context, |
99 dispatch, | 98 dispatch, |
100 error, | 99 error, |
101 extensions, | 100 extensions, |
102 filelog, | 101 filelog, |
479 ui.status(_('\n\tkeywords expanded\n')) | 478 ui.status(_('\n\tkeywords expanded\n')) |
480 ui.write(repo.wread(fn)) | 479 ui.write(repo.wread(fn)) |
481 repo.wvfs.rmtree(repo.root) | 480 repo.wvfs.rmtree(repo.root) |
482 | 481 |
483 @command('kwexpand', | 482 @command('kwexpand', |
484 commands.walkopts, | 483 cmdutil.walkopts, |
485 _('hg kwexpand [OPTION]... [FILE]...'), | 484 _('hg kwexpand [OPTION]... [FILE]...'), |
486 inferrepo=True) | 485 inferrepo=True) |
487 def expand(ui, repo, *pats, **opts): | 486 def expand(ui, repo, *pats, **opts): |
488 '''expand keywords in the working directory | 487 '''expand keywords in the working directory |
489 | 488 |
496 | 495 |
497 @command('kwfiles', | 496 @command('kwfiles', |
498 [('A', 'all', None, _('show keyword status flags of all files')), | 497 [('A', 'all', None, _('show keyword status flags of all files')), |
499 ('i', 'ignore', None, _('show files excluded from expansion')), | 498 ('i', 'ignore', None, _('show files excluded from expansion')), |
500 ('u', 'unknown', None, _('only show unknown (not tracked) files')), | 499 ('u', 'unknown', None, _('only show unknown (not tracked) files')), |
501 ] + commands.walkopts, | 500 ] + cmdutil.walkopts, |
502 _('hg kwfiles [OPTION]... [FILE]...'), | 501 _('hg kwfiles [OPTION]... [FILE]...'), |
503 inferrepo=True) | 502 inferrepo=True) |
504 def files(ui, repo, *pats, **opts): | 503 def files(ui, repo, *pats, **opts): |
505 '''show files configured for keyword expansion | 504 '''show files configured for keyword expansion |
506 | 505 |
555 fm.write('kwstatus path', fmt, char, | 554 fm.write('kwstatus path', fmt, char, |
556 repo.pathto(f, cwd), label=label) | 555 repo.pathto(f, cwd), label=label) |
557 fm.end() | 556 fm.end() |
558 | 557 |
559 @command('kwshrink', | 558 @command('kwshrink', |
560 commands.walkopts, | 559 cmdutil.walkopts, |
561 _('hg kwshrink [OPTION]... [FILE]...'), | 560 _('hg kwshrink [OPTION]... [FILE]...'), |
562 inferrepo=True) | 561 inferrepo=True) |
563 def shrink(ui, repo, *pats, **opts): | 562 def shrink(ui, repo, *pats, **opts): |
564 '''revert expanded keywords in the working directory | 563 '''revert expanded keywords in the working directory |
565 | 564 |