Can I customize the merciless interceptors as some extensions are configured in the hgrc file?

I know how to indicate which interceptors fire when. I want to know if it is possible to pass the configuration to hook via the hgrc file. Extensions can do this, for example.

 [extensions] someextension = something [someextension] some.config = 1 some.other.config = True 

I want to be able to do something similar for interceptions, for example.

 [hooks] changegroup.mail_someone = python:something [changegroup.mail_someone] to_address = some.email.address@somewhere.com 

Is something like this possible? Finding a way to do this did not bring anything useful ... If it is possible, how can I go about reading in the config in my Python in-process hook handler?

+6
source share
1 answer

Let me answer for both types of hook:

  • in the process will use ui.config and related methods to read the configuration of the value:

     address = ui.config('changegroup.mail_someone', 'to_address') 

    You can also use ui.configbool and ui.configlist to read Booleans and lists, respectively.

  • an external hook can use hg showconfig to retrieve the configuration value:

     $ hg showconfig changegroup.mail_someone.to_address 

    This will return some.email.address@somewhere.com to stdout. you can use

     $ hg showconfig changegroup.mail_someone 

    to see all the settings in this particular section.

+6
source

Source: https://habr.com/ru/post/909989/


All Articles