Show More
@@ -105,6 +105,7 b' test-directaccess.t' | |||
|
105 | 105 | test-dirstate-backup.t |
|
106 | 106 | test-dirstate-nonnormalset.t |
|
107 | 107 | test-dirstate.t |
|
108 | test-dispatch.py | |
|
108 | 109 | test-doctest.py |
|
109 | 110 | test-double-merge.t |
|
110 | 111 | test-drawdag.t |
@@ -1,18 +1,24 b'' | |||
|
1 | 1 | from __future__ import absolute_import, print_function |
|
2 | 2 | import os |
|
3 | import sys | |
|
3 | 4 | from mercurial import ( |
|
4 | 5 | dispatch, |
|
5 | 6 | ) |
|
6 | 7 | |
|
8 | def printb(data, end=b'\n'): | |
|
9 | out = getattr(sys.stdout, 'buffer', sys.stdout) | |
|
10 | out.write(data + end) | |
|
11 | out.flush() | |
|
12 | ||
|
7 | 13 | def testdispatch(cmd): |
|
8 | 14 | """Simple wrapper around dispatch.dispatch() |
|
9 | 15 | |
|
10 | 16 | Prints command and result value, but does not handle quoting. |
|
11 | 17 | """ |
|
12 | print(b"running: %s" % (cmd,)) | |
|
18 | printb(b"running: %s" % (cmd,)) | |
|
13 | 19 | req = dispatch.request(cmd.split()) |
|
14 | 20 | result = dispatch.dispatch(req) |
|
15 | print(b"result: %r" % (result,)) | |
|
21 | printb(b"result: %r" % (result,)) | |
|
16 | 22 | |
|
17 | 23 | testdispatch(b"init test1") |
|
18 | 24 | os.chdir('test1') |
General Comments 0
You need to be logged in to leave comments.
Login now