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