Show More
@@ -1,38 +1,38 b'' | |||||
1 | from __future__ import absolute_import |
|
1 | from __future__ import absolute_import | |
2 | import os |
|
2 | import os | |
3 | from mercurial import ( |
|
3 | from mercurial import ( | |
4 | dispatch, |
|
4 | dispatch, | |
5 | ui as uimod, |
|
5 | ui as uimod, | |
6 | ) |
|
6 | ) | |
7 |
|
7 | |||
8 | def testdispatch(cmd): |
|
8 | def testdispatch(cmd): | |
9 | """Simple wrapper around dispatch.dispatch() |
|
9 | """Simple wrapper around dispatch.dispatch() | |
10 |
|
10 | |||
11 | Prints command and result value, but does not handle quoting. |
|
11 | Prints command and result value, but does not handle quoting. | |
12 | """ |
|
12 | """ | |
13 | ui = uimod.ui.load() |
|
13 | ui = uimod.ui.load() | |
14 | ui.status("running: %s\n" % cmd) |
|
14 | ui.status(b"running: %s\n" % cmd) | |
15 | req = dispatch.request(cmd.split(), ui) |
|
15 | req = dispatch.request(cmd.split(), ui) | |
16 | result = dispatch.dispatch(req) |
|
16 | result = dispatch.dispatch(req) | |
17 | ui.status("result: %r\n" % result) |
|
17 | ui.status(b"result: %r\n" % result) | |
18 |
|
18 | |||
19 | # create file 'foo', add and commit |
|
19 | # create file 'foo', add and commit | |
20 | f = open('foo', 'wb') |
|
20 | f = open(b'foo', 'wb') | |
21 | f.write('foo\n') |
|
21 | f.write(b'foo\n') | |
22 | f.close() |
|
22 | f.close() | |
23 | testdispatch("--debug add foo") |
|
23 | testdispatch(b"--debug add foo") | |
24 | testdispatch("--debug commit -m commit1 -d 2000-01-01 foo") |
|
24 | testdispatch(b"--debug commit -m commit1 -d 2000-01-01 foo") | |
25 |
|
25 | |||
26 | # append to file 'foo' and commit |
|
26 | # append to file 'foo' and commit | |
27 | f = open('foo', 'ab') |
|
27 | f = open(b'foo', 'ab') | |
28 | f.write('bar\n') |
|
28 | f.write(b'bar\n') | |
29 | f.close() |
|
29 | f.close() | |
30 | # remove blackbox.log directory (proxy for readonly log file) |
|
30 | # remove blackbox.log directory (proxy for readonly log file) | |
31 | os.rmdir(".hg/blackbox.log") |
|
31 | os.rmdir(b".hg/blackbox.log") | |
32 | # replace it with the real blackbox.log file |
|
32 | # replace it with the real blackbox.log file | |
33 | os.rename(".hg/blackbox.log-", ".hg/blackbox.log") |
|
33 | os.rename(b".hg/blackbox.log-", b".hg/blackbox.log") | |
34 | testdispatch("--debug commit -m commit2 -d 2000-01-02 foo") |
|
34 | testdispatch(b"--debug commit -m commit2 -d 2000-01-02 foo") | |
35 |
|
35 | |||
36 | # check 88803a69b24 (fancyopts modified command table) |
|
36 | # check 88803a69b24 (fancyopts modified command table) | |
37 | testdispatch("--debug log -r 0") |
|
37 | testdispatch(b"--debug log -r 0") | |
38 | testdispatch("--debug log -r tip") |
|
38 | testdispatch(b"--debug log -r tip") |
General Comments 0
You need to be logged in to leave comments.
Login now