comparison tests/blackbox-readonly-dispatch.py @ 40729:c93d046d4300

extensions: add "uipopulate" hook, called per instance, not per process In short, this is the "reposetup" function for ui. It allows us to modify ui attributes without extending ui.__class__. Before, the only way to do that was to abuse the config dictionary, which is copied across ui instances. See the next patch for usage example.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 12 Nov 2018 21:10:51 +0900
parents f4a508f4ea87
children 2372284d9457
comparison
equal deleted inserted replaced
40728:2cd5f1fac788 40729:c93d046d4300
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 extensions,
5 ui as uimod, 6 ui as uimod,
6 ) 7 )
7 8
8 def testdispatch(cmd): 9 def testdispatch(cmd):
9 """Simple wrapper around dispatch.dispatch() 10 """Simple wrapper around dispatch.dispatch()
10 11
11 Prints command and result value, but does not handle quoting. 12 Prints command and result value, but does not handle quoting.
12 """ 13 """
13 ui = uimod.ui.load() 14 ui = uimod.ui.load()
15 extensions.populateui(ui)
14 ui.status(b"running: %s\n" % cmd) 16 ui.status(b"running: %s\n" % cmd)
15 req = dispatch.request(cmd.split(), ui) 17 req = dispatch.request(cmd.split(), ui)
16 result = dispatch.dispatch(req) 18 result = dispatch.dispatch(req)
17 ui.status(b"result: %r\n" % result) 19 ui.status(b"result: %r\n" % result)
18 20