##// END OF EJS Templates
py3: add b'' prefixes in tests/test-extension.t...
Pulkit Goyal -
r36476:2218f5bf default
parent child Browse files
Show More
@@ -7,22 +7,22 b' Test basic extension support'
7 > command = registrar.command(cmdtable)
7 > command = registrar.command(cmdtable)
8 > configtable = {}
8 > configtable = {}
9 > configitem = registrar.configitem(configtable)
9 > configitem = registrar.configitem(configtable)
10 > configitem('tests', 'foo', default="Foo")
10 > configitem(b'tests', b'foo', default=b"Foo")
11 > def uisetup(ui):
11 > def uisetup(ui):
12 > ui.write("uisetup called\\n")
12 > ui.write(b"uisetup called\\n")
13 > ui.flush()
13 > ui.flush()
14 > def reposetup(ui, repo):
14 > def reposetup(ui, repo):
15 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
15 > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root))
16 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
16 > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!"))
17 > ui.flush()
17 > ui.flush()
18 > @command(b'foo', [], 'hg foo')
18 > @command(b'foo', [], b'hg foo')
19 > def foo(ui, *args, **kwargs):
19 > def foo(ui, *args, **kwargs):
20 > foo = ui.config('tests', 'foo')
20 > foo = ui.config(b'tests', b'foo')
21 > ui.write(foo)
21 > ui.write(foo)
22 > ui.write("\\n")
22 > ui.write(b"\\n")
23 > @command(b'bar', [], 'hg bar', norepo=True)
23 > @command(b'bar', [], b'hg bar', norepo=True)
24 > def bar(ui, *args, **kwargs):
24 > def bar(ui, *args, **kwargs):
25 > ui.write("Bar\\n")
25 > ui.write(b"Bar\\n")
26 > EOF
26 > EOF
27 $ abspath=`pwd`/foobar.py
27 $ abspath=`pwd`/foobar.py
28
28
@@ -440,12 +440,12 b' Setup main procedure of extension.'
440 > @command(b'showabsolute', [], norepo=True)
440 > @command(b'showabsolute', [], norepo=True)
441 > def showabsolute(ui, *args, **opts):
441 > def showabsolute(ui, *args, **opts):
442 > from absextroot import absolute
442 > from absextroot import absolute
443 > ui.write('ABS: %s\n' % '\nABS: '.join(absolute.getresult()))
443 > ui.write(b'ABS: %s\n' % '\nABS: '.join(absolute.getresult()))
444 >
444 >
445 > @command(b'showrelative', [], norepo=True)
445 > @command(b'showrelative', [], norepo=True)
446 > def showrelative(ui, *args, **opts):
446 > def showrelative(ui, *args, **opts):
447 > from . import relative
447 > from . import relative
448 > ui.write('REL: %s\n' % '\nREL: '.join(relative.getresult()))
448 > ui.write(b'REL: %s\n' % '\nREL: '.join(relative.getresult()))
449 >
449 >
450 > # import modules from external library
450 > # import modules from external library
451 > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
451 > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
@@ -564,11 +564,11 b' hide outer repo'
564 > from mercurial import registrar
564 > from mercurial import registrar
565 > cmdtable = {}
565 > cmdtable = {}
566 > command = registrar.command(cmdtable)
566 > command = registrar.command(cmdtable)
567 > @command(b'debugfoobar', [], 'hg debugfoobar')
567 > @command(b'debugfoobar', [], b'hg debugfoobar')
568 > def debugfoobar(ui, repo, *args, **opts):
568 > def debugfoobar(ui, repo, *args, **opts):
569 > "yet another debug command"
569 > "yet another debug command"
570 > pass
570 > pass
571 > @command(b'foo', [], 'hg foo')
571 > @command(b'foo', [], b'hg foo')
572 > def foo(ui, repo, *args, **opts):
572 > def foo(ui, repo, *args, **opts):
573 > """yet another foo command
573 > """yet another foo command
574 > This command has been DEPRECATED since forever.
574 > This command has been DEPRECATED since forever.
@@ -805,7 +805,7 b' Test help topic with same name as extens'
805 > command = registrar.command(cmdtable)
805 > command = registrar.command(cmdtable)
806 > """multirevs extension
806 > """multirevs extension
807 > Big multi-line module docstring."""
807 > Big multi-line module docstring."""
808 > @command(b'multirevs', [], 'ARG', norepo=True)
808 > @command(b'multirevs', [], b'ARG', norepo=True)
809 > def multirevs(ui, repo, arg, *args, **opts):
809 > def multirevs(ui, repo, arg, *args, **opts):
810 > """multirevs command"""
810 > """multirevs command"""
811 > pass
811 > pass
@@ -880,14 +880,14 b' along with extension help itself'
880 > from mercurial import commands, registrar
880 > from mercurial import commands, registrar
881 > cmdtable = {}
881 > cmdtable = {}
882 > command = registrar.command(cmdtable)
882 > command = registrar.command(cmdtable)
883 > @command(b'dodo', [], 'hg dodo')
883 > @command(b'dodo', [], b'hg dodo')
884 > def dodo(ui, *args, **kwargs):
884 > def dodo(ui, *args, **kwargs):
885 > """Does nothing"""
885 > """Does nothing"""
886 > ui.write("I do nothing. Yay\\n")
886 > ui.write(b"I do nothing. Yay\\n")
887 > @command(b'foofoo', [], 'hg foofoo')
887 > @command(b'foofoo', [], b'hg foofoo')
888 > def foofoo(ui, *args, **kwargs):
888 > def foofoo(ui, *args, **kwargs):
889 > """Writes 'Foo foo'"""
889 > """Writes 'Foo foo'"""
890 > ui.write("Foo foo\\n")
890 > ui.write(b"Foo foo\\n")
891 > EOF
891 > EOF
892 $ dodopath=$TESTTMP/d/dodo.py
892 $ dodopath=$TESTTMP/d/dodo.py
893
893
@@ -991,14 +991,14 b' along with extension help'
991 > from mercurial import commands, registrar
991 > from mercurial import commands, registrar
992 > cmdtable = {}
992 > cmdtable = {}
993 > command = registrar.command(cmdtable)
993 > command = registrar.command(cmdtable)
994 > @command(b'something', [], 'hg something')
994 > @command(b'something', [], b'hg something')
995 > def something(ui, *args, **kwargs):
995 > def something(ui, *args, **kwargs):
996 > """Does something"""
996 > """Does something"""
997 > ui.write("I do something. Yaaay\\n")
997 > ui.write(b"I do something. Yaaay\\n")
998 > @command(b'beep', [], 'hg beep')
998 > @command(b'beep', [], b'hg beep')
999 > def beep(ui, *args, **kwargs):
999 > def beep(ui, *args, **kwargs):
1000 > """Writes 'Beep beep'"""
1000 > """Writes 'Beep beep'"""
1001 > ui.write("Beep beep\\n")
1001 > ui.write(b"Beep beep\\n")
1002 > EOF
1002 > EOF
1003 $ dudupath=$TESTTMP/d/dudu.py
1003 $ dudupath=$TESTTMP/d/dudu.py
1004
1004
@@ -1235,7 +1235,7 b' Broken disabled extension and command:'
1235 > cmdtable = {}
1235 > cmdtable = {}
1236 > command = registrar.command(cmdtable)
1236 > command = registrar.command(cmdtable)
1237 > class Bogon(Exception): pass
1237 > class Bogon(Exception): pass
1238 > @command(b'throw', [], 'hg throw', norepo=True)
1238 > @command(b'throw', [], b'hg throw', norepo=True)
1239 > def throw(ui, **opts):
1239 > def throw(ui, **opts):
1240 > """throws an exception"""
1240 > """throws an exception"""
1241 > raise Bogon()
1241 > raise Bogon()
@@ -1278,8 +1278,8 b' If the extension specifies a buglink, sh'
1278 If the extensions declare outdated versions, accuse the older extension first:
1278 If the extensions declare outdated versions, accuse the older extension first:
1279 $ echo "from mercurial import util" >> older.py
1279 $ echo "from mercurial import util" >> older.py
1280 $ echo "util.version = lambda:'2.2'" >> older.py
1280 $ echo "util.version = lambda:'2.2'" >> older.py
1281 $ echo "testedwith = '1.9.3'" >> older.py
1281 $ echo "testedwith = b'1.9.3'" >> older.py
1282 $ echo "testedwith = '2.1.1'" >> throw.py
1282 $ echo "testedwith = b'2.1.1'" >> throw.py
1283 $ rm -f throw.pyc throw.pyo
1283 $ rm -f throw.pyc throw.pyo
1284 $ rm -Rf __pycache__
1284 $ rm -Rf __pycache__
1285 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1285 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
@@ -1293,7 +1293,7 b' If the extensions declare outdated versi'
1293 ** Extensions loaded: throw, older
1293 ** Extensions loaded: throw, older
1294
1294
1295 One extension only tested with older, one only with newer versions:
1295 One extension only tested with older, one only with newer versions:
1296 $ echo "util.version = lambda:'2.1'" >> older.py
1296 $ echo "util.version = lambda:b'2.1'" >> older.py
1297 $ rm -f older.pyc older.pyo
1297 $ rm -f older.pyc older.pyo
1298 $ rm -Rf __pycache__
1298 $ rm -Rf __pycache__
1299 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1299 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
@@ -1307,7 +1307,7 b' One extension only tested with older, on'
1307 ** Extensions loaded: throw, older
1307 ** Extensions loaded: throw, older
1308
1308
1309 Older extension is tested with current version, the other only with newer:
1309 Older extension is tested with current version, the other only with newer:
1310 $ echo "util.version = lambda:'1.9.3'" >> older.py
1310 $ echo "util.version = lambda:b'1.9.3'" >> older.py
1311 $ rm -f older.pyc older.pyo
1311 $ rm -f older.pyc older.pyo
1312 $ rm -Rf __pycache__
1312 $ rm -Rf __pycache__
1313 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
1313 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
@@ -1345,8 +1345,8 b' Declare the version as supporting this h'
1345 ** Extensions loaded: throw
1345 ** Extensions loaded: throw
1346
1346
1347 Patch version is ignored during compatibility check
1347 Patch version is ignored during compatibility check
1348 $ echo "testedwith = '3.2'" >> throw.py
1348 $ echo "testedwith = b'3.2'" >> throw.py
1349 $ echo "util.version = lambda:'3.2.2'" >> throw.py
1349 $ echo "util.version = lambda:b'3.2.2'" >> throw.py
1350 $ rm -f throw.pyc throw.pyo
1350 $ rm -f throw.pyc throw.pyo
1351 $ rm -Rf __pycache__
1351 $ rm -Rf __pycache__
1352 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
1352 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
@@ -1438,8 +1438,8 b' Refuse to load extensions with minimum v'
1438
1438
1439 $ cat > minversion1.py << EOF
1439 $ cat > minversion1.py << EOF
1440 > from mercurial import util
1440 > from mercurial import util
1441 > util.version = lambda: '3.5.2'
1441 > util.version = lambda: b'3.5.2'
1442 > minimumhgversion = '3.6'
1442 > minimumhgversion = b'3.6'
1443 > EOF
1443 > EOF
1444 $ hg --config extensions.minversion=minversion1.py version
1444 $ hg --config extensions.minversion=minversion1.py version
1445 (third party extension minversion requires version 3.6 or newer of Mercurial; disabling)
1445 (third party extension minversion requires version 3.6 or newer of Mercurial; disabling)
@@ -1452,8 +1452,8 b' Refuse to load extensions with minimum v'
1452
1452
1453 $ cat > minversion2.py << EOF
1453 $ cat > minversion2.py << EOF
1454 > from mercurial import util
1454 > from mercurial import util
1455 > util.version = lambda: '3.6'
1455 > util.version = lambda: b'3.6'
1456 > minimumhgversion = '3.7'
1456 > minimumhgversion = b'3.7'
1457 > EOF
1457 > EOF
1458 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1458 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1459 (third party extension minversion requires version 3.7 or newer of Mercurial; disabling)
1459 (third party extension minversion requires version 3.7 or newer of Mercurial; disabling)
@@ -1462,8 +1462,8 b' Can load version that is only off by poi'
1462
1462
1463 $ cat > minversion2.py << EOF
1463 $ cat > minversion2.py << EOF
1464 > from mercurial import util
1464 > from mercurial import util
1465 > util.version = lambda: '3.6.1'
1465 > util.version = lambda: b'3.6.1'
1466 > minimumhgversion = '3.6'
1466 > minimumhgversion = b'3.6'
1467 > EOF
1467 > EOF
1468 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1468 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1469 [1]
1469 [1]
@@ -1472,8 +1472,8 b' Can load minimum version identical to cu'
1472
1472
1473 $ cat > minversion3.py << EOF
1473 $ cat > minversion3.py << EOF
1474 > from mercurial import util
1474 > from mercurial import util
1475 > util.version = lambda: '3.5'
1475 > util.version = lambda: b'3.5'
1476 > minimumhgversion = '3.5'
1476 > minimumhgversion = b'3.5'
1477 > EOF
1477 > EOF
1478 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1478 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1479 [1]
1479 [1]
@@ -1492,7 +1492,7 b' Commands handling multiple repositories '
1492 $ cat > $TESTTMP/reposetuptest.py <<EOF
1492 $ cat > $TESTTMP/reposetuptest.py <<EOF
1493 > from mercurial import extensions
1493 > from mercurial import extensions
1494 > def reposetup(ui, repo):
1494 > def reposetup(ui, repo):
1495 > ui.write('reposetup() for %s\n' % (repo.root))
1495 > ui.write(b'reposetup() for %s\n' % (repo.root))
1496 > ui.flush()
1496 > ui.flush()
1497 > EOF
1497 > EOF
1498 $ hg init src
1498 $ hg init src
@@ -1626,7 +1626,7 b' Prohibit registration of commands that d'
1626 > def deprecatedcmd(repo, ui):
1626 > def deprecatedcmd(repo, ui):
1627 > pass
1627 > pass
1628 > cmdtable = {
1628 > cmdtable = {
1629 > 'deprecatedcmd': (deprecatedcmd, [], ''),
1629 > b'deprecatedcmd': (deprecatedcmd, [], b''),
1630 > }
1630 > }
1631 > EOF
1631 > EOF
1632 $ cat <<EOF > .hg/hgrc
1632 $ cat <<EOF > .hg/hgrc
@@ -1663,7 +1663,7 b' Test synopsis and docstring extending'
1663 > docstring = '''
1663 > docstring = '''
1664 > GREPME make sure that this is in the help!
1664 > GREPME make sure that this is in the help!
1665 > '''
1665 > '''
1666 > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
1666 > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks,
1667 > synopsis, docstring)
1667 > synopsis, docstring)
1668 > EOF
1668 > EOF
1669 $ abspath=`pwd`/exthelp.py
1669 $ abspath=`pwd`/exthelp.py
@@ -1698,7 +1698,7 b' Prohibit the use of unicode strings as t'
1698 > from mercurial import registrar
1698 > from mercurial import registrar
1699 > cmdtable = {}
1699 > cmdtable = {}
1700 > command = registrar.command(cmdtable)
1700 > command = registrar.command(cmdtable)
1701 > @command('dummy', [('', 'opt', u'value', u'help')], 'ext [OPTIONS]')
1701 > @command(b'dummy', [('', 'opt', u'value', u'help')], 'ext [OPTIONS]')
1702 > def ext(*args, **opts):
1702 > def ext(*args, **opts):
1703 > print(opts['opt'])
1703 > print(opts['opt'])
1704 > EOF
1704 > EOF
General Comments 0
You need to be logged in to leave comments. Login now