Normally, I would enable extensions by adding the following to .hg/hgrc
:
[extensions]
hgext.win32text=
[encode]
** = cleverencode:
[decode]
** = cleverdecode:
However, I want this configuration to be versioned, i.e. part of the repository, so that it is enabled for anyone else (coworkers, build machines) cloning the repository. Note that whomsoever clones the repository should not be required to do anything to enable these extensions.
It appears it is not possible from the documentation, but does anyone know any neat tricks that can help me here?
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
into
.hg/hgrc
. Having done that, you can then effectively control their Mercurial settings by committing changes tocommon-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 linehg status
).You might be able to solve that problem via the ProjRC extension.
“This extension makes Mercurial look for and parse .hg/projrc for additional configuration settings. The file is transferred on clone and on pull (but never on push)”
What about creating a link from
.hg/hgrc
to e.g.customhg/hgrc
so that it gets versioned. Then you need to create some hook that copies it back to.hg/hgrc
- e.g. after each update.You want mercurial to do something automatically when you clone a repo (update the hooks or config). Documentation says it is not possible and gives some very good reasons:
So clearly, mercurial itself won't solve your problem. You clearly state that you want nothing but mercurial to solve your problem, so the answer is: what you are asking is not possible.
The only way to solve your problem is that all your users will have to run/install at least once a given script that perform the actions you want, something like installing the right hooks.
If you want to be clever about this:
A bit complicated, but that's the closest I can imagine to your requirements: