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

login
register
mail settings
Submitter Gregory Szorc
Date May 5, 2014, 5:51 a.m.
Message ID <78059bc9fedddd37c619.1399269089@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4615/
State Accepted
Commit c4633e287c56c3d588ab6f36786b92d35b1975cc
Headers show

Comments

Gregory Szorc - May 5, 2014, 5:51 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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

Patch

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.