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

mail settings
Submitter Gregory Szorc
Date May 5, 2014, 5:51 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/4615/
State Accepted
Commit c4633e287c56c3d588ab6f36786b92d35b1975cc
Headers show


Gregory Szorc - May 5, 2014, 5:51 a.m.
# HG changeset patch
# User Gregory Szorc <>
# 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/ b/hgext/
--- a/hgext/
+++ b/hgext/
@@ -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)
          [('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
     Extend the current configuration by specifying maps as arguments
     and using -f/--rcfile to source an external hgrc file.