keyword: define inferrepo in command decorator
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 04 May 2014 22:32:15 -0700
changeset 21784 44efd5b9ce45
parent 21783 82bf4d89e068
child 21785 a730b002c5db
keyword: define inferrepo in command decorator
hgext/keyword.py
--- a/hgext/keyword.py	Sun May 04 22:33:22 2014 -0700
+++ b/hgext/keyword.py	Sun May 04 22:32:15 2014 -0700
@@ -89,8 +89,6 @@
 from mercurial.i18n import _
 import os, re, shutil, tempfile
 
-commands.inferrepo += ' kwexpand kwfiles kwshrink'
-
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 testedwith = 'internal'
@@ -454,7 +452,10 @@
     ui.write(repo.wread(fn))
     shutil.rmtree(tmpdir, ignore_errors=True)
 
-@command('kwexpand', commands.walkopts, _('hg kwexpand [OPTION]... [FILE]...'))
+@command('kwexpand',
+    commands.walkopts,
+    _('hg kwexpand [OPTION]... [FILE]...'),
+    inferrepo=True)
 def expand(ui, repo, *pats, **opts):
     '''expand keywords in the working directory
 
@@ -470,7 +471,8 @@
           ('i', 'ignore', None, _('show files excluded from expansion')),
           ('u', 'unknown', None, _('only show unknown (not tracked) files')),
          ] + commands.walkopts,
-         _('hg kwfiles [OPTION]... [FILE]...'))
+         _('hg kwfiles [OPTION]... [FILE]...'),
+         inferrepo=True)
 def files(ui, repo, *pats, **opts):
     '''show files configured for keyword expansion
 
@@ -524,7 +526,10 @@
                      repo.pathto(f, cwd), label=label)
     fm.end()
 
-@command('kwshrink', commands.walkopts, _('hg kwshrink [OPTION]... [FILE]...'))
+@command('kwshrink',
+    commands.walkopts,
+    _('hg kwshrink [OPTION]... [FILE]...'),
+    inferrepo=True)
 def shrink(ui, repo, *pats, **opts):
     '''revert expanded keywords in the working directory