API for an extension to register a hook?

Tory Patnoe tpatnoe at cisco.com
Wed Jan 13 11:24:41 CST 2010


On 01/11/2010 02:55 PM, Matt Mackall wrote:
>
>> I remember having problems because I used reposetup and that didn't
>> work. I'm afraid I also don't fully understand why we need to have both
>> a 'ui' and a 'lui' object around. Is it because the 'ui' object is
>> associated with the program execution as a whole and 'lui' is associated
>> with the 'repo' object?
>>      
> Yes. And we can have between 0-2 repo objects in existence, depending on
> which command is invoked.
>
>    
Moving the setconfig into reposetup from uisetup did the trick. I think 
I'm beginning to understand.


def reposetup(ui, repo):
     rally_config['id.required'] = ui.configbool("rally", "id.required", 
default=False)

     # Setup 'permanent' hooks
     if rally_config['id.required']:
         ui.setconfig('hooks', 'pretxncommit.rally', do_pretxncommit)
         ui.setconfig('hooks', 'do_pretxnchangegroup.rally', 
do_pretxncommit)





More information about the Mercurial mailing list