mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
de804dc6c0
Summary: The undo tests use timing to detect when the lock is being taken. This is flaky. Instead add extra logging to detect when the lock is taken. Reviewed By: quark-zju Differential Revision: D13504643 fbshipit-source-id: 07b80e416047d11b4ba3e1631c2385e5f12fa36f
22 lines
643 B
Python
22 lines
643 B
Python
"""enable ui.log output in tests
|
|
|
|
Wraps the ``ui.log`` method, printing out events which are enabled.
|
|
|
|
To enable events add them to the ``extralog.events`` config list.
|
|
"""
|
|
|
|
|
|
def uisetup(ui):
|
|
class extralogui(ui.__class__):
|
|
def log(self, event, *msg, **opts):
|
|
items = self.configlist("extralog", "events")
|
|
if event in items:
|
|
if msg:
|
|
ui.write("%s: " % event)
|
|
ui.write(msg[0] % msg[1:])
|
|
else:
|
|
ui.write("%s\n" % event)
|
|
return super(extralogui, self).log(event, *msg, **opts)
|
|
|
|
ui.__class__ = extralogui
|