Version-controlled extension configuration in Mercurial

前端 未结 2 945
孤城傲影
孤城傲影 2021-02-15 10:56

Normally, I would enable extensions by adding the following to .hg/hgrc:

[extensions]
hgext.win32text=
[encode]
** = cleverencode:
[decode]
** = cle         


        
2条回答
  •  没有蜡笔的小新
    2021-02-15 11:36

    The current development version of Mercurial (to be released as Mercurial 1.3 on July 1st) supports a %include directive in its configuration files.

    That means that you can ask people to put

    %include ../common-hgrc
    

    into .hg/hgrc. Having done that, you can then effectively control their Mercurial settings by committing changes to common-hgrc. When they pull the change, the new settings will take effect.

    Do note, that this is dangerous: anybody who can get you to pull changes into your repository can now insert arbitrary hooks into common-hgrc and you will execute them on the next Mercurial command (even a "safe" command line hg status).

提交回复
热议问题