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