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