[PATCH 1 of 3] keyword: monkeypatch dispatch._runcommand instead of _parse

Christian Ebert blacktrash at gmx.net
Mon Jun 2 08:31:19 CDT 2008


* Dirkjan Ochtman on Monday, June 02, 2008 at 11:56:02 +0000
> Christian Ebert <blacktrash <at> gmx.net> writes:
>> +        def kwdispatch_runcommand(ui, options, cmd, cmdfunc):
>>             kwtools['hgcmd'] = cmd
>> -            return cmd, func, args, options, cmdoptions
>> +            return dispatch_runcommand(ui, options, cmd, cmdfunc)
>> 
>> -        dispatch_parse = dispatch._parse
>> -        dispatch._parse = kwdispatch_parse
>> +        dispatch_runcommand = dispatch._runcommand
>> +        dispatch._runcommand = kwdispatch_runcommand
> 
> I think this might be a bit easier to read if you define dispatch_runcommand
> before defining kwdispatch_runcommand.

That's how I did it for all the monkeypatches in keyword.py --
until I tried to obey the, ahem, unwritten standards in eg.
highlight.py or pager.py.

I'm fine with either way, but maybe there should be some kind of
convention for monkeys ;)

What do you propose?

If we agree on storing the method to be "monkeyed" before the
redefinition, I think it's better I submit an extra patch that
does this for my monkey zoo.

c
-- 
  Was heißt hier Dogma, ich bin Underdogma!
[ What the hell do you mean dogma, I am underdogma. ]

_F R E E_  _V I D E O S_  -->>  http://www.blacktrash.org/underdogma/


More information about the Mercurial-devel mailing list