changeset 21784:44efd5b9ce45

keyword: define inferrepo in command decorator
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 May 2014 22:32:15 -0700
parents 82bf4d89e068
children a730b002c5db
files hgext/keyword.py
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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