I tried to subclass ui to redirect the output to a gui window, by refining ui.write(). Most commands seems to work, but the diff output (hg diff, hg log -p, hg export) are still sent to stdout. Any pointers or advice on what I should do?