Patchwork [21,of,35] tests: define norepo in command decorator

login
register
mail settings
Submitter Gregory Szorc
Date May 5, 2014, 5:51 a.m.
Message ID <91d16a0390e01bbf1c5e.1399269086@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4612/
State Accepted
Commit 26d2fb899637086388b0368edaff8ecf6669ef8f
Headers show

Comments

Gregory Szorc - May 5, 2014, 5:51 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1399266465 25200
#      Sun May 04 22:07:45 2014 -0700
# Branch stable
# Node ID 91d16a0390e01bbf1c5e46f7b909221502b8af91
# Parent  2c0f9ae73936b5c894cb03e1a4469292cacf2fbb
tests: define norepo in command decorator

Patch

diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py
--- a/tests/test-commandserver.py
+++ b/tests/test-commandserver.py
@@ -336,20 +336,19 @@  if __name__ == '__main__':
     hgrc.close()
     check(obsolete)
     hgrc = open('.hg/hgrc', 'a')
     hgrc.write('[extensions]\nmq=\n')
     hgrc.close()
     check(mqoutsidechanges)
     dbg = open('dbgui.py', 'w')
     dbg.write('from mercurial import cmdutil, commands\n'
-              'commands.norepo += " debuggetpass"\n'
               'cmdtable = {}\n'
               'command = cmdutil.command(cmdtable)\n'
-              '@command("debuggetpass")\n'
+              '@command("debuggetpass", norepo=True)\n'
               'def debuggetpass(ui):\n'
               '    ui.write("%s\\n" % ui.getpass())\n')
     dbg.close()
     hgrc = open('.hg/hgrc', 'a')
     hgrc.write('[extensions]\ndbgui=dbgui.py\n')
     hgrc.close()
     check(getpass)
 
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -13,21 +13,20 @@  Test basic extension support
   > def reposetup(ui, repo):
   >     ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
   >     ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
   > 
   > @command('foo', [], 'hg foo')
   > def foo(ui, *args, **kwargs):
   >     ui.write("Foo\\n")
   > 
-  > @command('bar', [], 'hg bar')
+  > @command('bar', [], 'hg bar', norepo=True)
   > def bar(ui, *args, **kwargs):
   >     ui.write("Bar\\n")
   > 
-  > commands.norepo += ' bar'
   > EOF
   $ abspath=`pwd`/foobar.py
 
   $ mkdir barfoo
   $ cp foobar.py barfoo/__init__.py
   $ barfoopath=`pwd`/barfoo
 
   $ hg init a
@@ -476,21 +475,20 @@  Extension module help vs command help:
 Test help topic with same name as extension
 
   $ cat > multirevs.py <<EOF
   > from mercurial import cmdutil, commands
   > cmdtable = {}
   > command = cmdutil.command(cmdtable)
   > """multirevs extension
   > Big multi-line module docstring."""
-  > @command('multirevs', [], 'ARG')
+  > @command('multirevs', [], 'ARG', norepo=True)
   > def multirevs(ui, repo, arg, *args, **opts):
   >     """multirevs command"""
   >     pass
-  > commands.norepo += ' multirevs'
   > EOF
   $ echo "multirevs = multirevs.py" >> $HGRCPATH
 
   $ hg help multirevs
   Specifying Multiple Revisions
   """""""""""""""""""""""""""""
   
       When Mercurial accepts more than one revision, they may be specified
@@ -532,22 +530,21 @@  Issue811: Problem loading extensions twi
   $ debugpath=`pwd`/debugissue811.py
   $ cat > debugissue811.py <<EOF
   > '''show all loaded extensions
   > '''
   > from mercurial import cmdutil, commands, extensions
   > cmdtable = {}
   > command = cmdutil.command(cmdtable)
   > 
-  > @command('debugextensions', [], 'hg debugextensions')
+  > @command('debugextensions', [], 'hg debugextensions', norepo=True)
   > def debugextensions(ui):
   >     "yet another debug command"
   >     ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
   > 
-  > commands.norepo += " debugextensions"
   > EOF
   $ echo "debugissue811 = $debugpath" >> $HGRCPATH
   $ echo "mq=" >> $HGRCPATH
   $ echo "strip=" >> $HGRCPATH
   $ echo "hgext.mq=" >> $HGRCPATH
   $ echo "hgext/mq=" >> $HGRCPATH
 
 Show extensions:
@@ -626,21 +623,20 @@  Broken disabled extension and command:
   [255]
 
   $ cat > throw.py <<EOF
   > from mercurial import cmdutil, commands
   > cmdtable = {}
   > command = cmdutil.command(cmdtable)
   > class Bogon(Exception): pass
   > 
-  > @command('throw', [], 'hg throw')
+  > @command('throw', [], 'hg throw', norepo=True)
   > def throw(ui, **opts):
   >     """throws an exception"""
   >     raise Bogon()
-  > commands.norepo += " throw"
   > EOF
 No declared supported version, extension complains:
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
   ** Unknown exception encountered with possibly-broken third-party extension throw
   ** which supports versions unknown of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -656,22 +656,22 @@  Test command without options
   > 
   > cmdtable = {}
   > command = cmdutil.command(cmdtable)
   > 
   > @command('nohelp',
   >     [('', 'longdesc', 3, 'x'*90),
   >     ('n', '', None, 'normal desc'),
   >     ('', 'newline', '', 'line1\nline2')],
-  >     'hg nohelp')
+  >     'hg nohelp',
+  >     norepo=True)
   > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
   > def nohelp(ui, *args, **kwargs):
   >     pass
   > 
-  > commands.norepo += ' nohelp'
   > EOF
   $ echo '[extensions]' >> $HGRCPATH
   $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
 
 Test command with no help text
 
   $ hg help nohelp
   hg nohelp
diff --git a/tests/test-progress.t b/tests/test-progress.t
--- a/tests/test-progress.t
+++ b/tests/test-progress.t
@@ -13,17 +13,18 @@ 
   >         self._time += 0.25
   >         return self._time
   > time.time = incrementingtime()
   > 
   > @command('loop',
   >     [('', 'total', '', 'override for total'),
   >     ('', 'nested', False, 'show nested results'),
   >     ('', 'parallel', False, 'show parallel sets of results')],
-  >     'hg loop LOOPS')
+  >     'hg loop LOOPS',
+  >     norepo=True)
   > def loop(ui, loops, **opts):
   >     loops = int(loops)
   >     total = None
   >     if loops >= 0:
   >         total = loops
   >     if opts.get('total', None):
   >         total = int(opts.get('total'))
   >     nested = False
@@ -41,17 +42,16 @@ 
   >                 nested_steps = 5
   >             for j in range(nested_steps):
   >                 ui.progress(
   >                   'nested', j, 'nested.%d' % j, 'nestnum', nested_steps)
   >             ui.progress(
   >               'nested', None, 'nested.done', 'nestnum', nested_steps)
   >     ui.progress('loop', None, 'loop.done', 'loopnum', total)
   > 
-  > commands.norepo += " loop"
   > EOF
 
   $ cp $HGRCPATH $HGRCPATH.orig
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "progress=" >> $HGRCPATH
   $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
   $ echo "[progress]" >> $HGRCPATH
   $ echo "format = topic bar number" >> $HGRCPATH