[PATCH 24 of 35] keyword: define optionalrepo in command decorator

Gregory Szorc gregory.szorc at gmail.com
Mon May 5 00:51:29 CDT 2014


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1399267016 25200
#      Sun May 04 22:16:56 2014 -0700
# Branch stable
# Node ID 78059bc9fedddd37c619dbd07ba1aff50909af0e
# Parent  1ae447c6135b80ab466304fdf4e59006e2145bb9
keyword: define optionalrepo in command decorator

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -84,17 +84,16 @@ like CVS' $Log$, are not supported. A ke
 
 from mercurial import commands, context, cmdutil, dispatch, filelog, extensions
 from mercurial import localrepo, match, patch, templatefilters, templater, util
 from mercurial import scmutil, pathutil
 from mercurial.hgweb import webcommands
 from mercurial.i18n import _
 import os, re, shutil, tempfile
 
-commands.optionalrepo += ' kwdemo'
 commands.inferrepo += ' kwexpand kwfiles kwshrink'
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 testedwith = 'internal'
 
 # hg commands that do not act on keywords
 nokwcommands = ('add addremove annotate bundle export grep incoming init log'
@@ -357,17 +356,18 @@ def _kwfwrite(ui, repo, expand, *pats, *
         kwt.overwrite(wctx, clean, True, expand)
     finally:
         wlock.release()
 
 @command('kwdemo',
          [('d', 'default', None, _('show default keyword template maps')),
           ('f', 'rcfile', '',
            _('read maps from rcfile'), _('FILE'))],
-         _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP]...'))
+         _('hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP]...'),
+         optionalrepo=True)
 def demo(ui, repo, *args, **opts):
     '''print [keywordmaps] configuration and an expansion example
 
     Show current, custom, or default keyword template maps and their
     expansions.
 
     Extend the current configuration by specifying maps as arguments
     and using -f/--rcfile to source an external hgrc file.


More information about the Mercurial-devel mailing list