Subclassing ui for TortoiseHg (was: Re: [PATCH 0 of 3] Progress indicator)

Thomas Arendsen Hein thomas at intevation.de
Tue Jul 24 08:06:14 CDT 2007


* TK Soh <teekaysoh at gmail.com> [20070724 03:18]:
> I've earlier attempted to subclass ui, mainly as a mean to capture
> Mercurial's output and feed them into a log window, but ran into
> problems.
> 
> BTW, one problem I noticed is that 'repo = hg.repository()' would
> still call for the stocked ui class, ignoring the ui subclass object
> that was passed into the function. The only workaround I can find is
> to manually override repo.ui with my ui subclass again, making things
> a little too messy for my taste. I can't explain everything so well
> here. Hopefully it's clear enough for the gurus.

You can probably do something like

from mercurial import ui

class myui(ui.ui):
    ...

ui.ui = myui

Thomas

-- 
thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Osnabrueck - Register: Amtsgericht Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner


More information about the Mercurial-devel mailing list