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