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?
Mercurial on Windows has a three-tier configuration system. A site-wide configuration file in C:\Program Files\TortoiseHg\Mercurial. ini This file is read first and thus has the lowest priority. A per-user configuration file in C:\Documents and Settings\username\Mercurial.
If you specify a -u option to the hg commit command on the command line, followed by a username, this is always given the highest precedence. If you have set the HGUSER environment variable, this is checked next. If you have set the EMAIL environment variable, this will be used next.
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:
Hooks do not propagate
In Mercurial, hooks are not revision controlled, and do not propagate when you clone,
or pull from, a repository. The reason for this is simple: a hook is a completely
arbitrary piece of executable code. It runs under your user identity, with your
privilege level, on your machine. No comments
It would be extremely reckless for any distributed revision control system to
implement revision-controlled hooks, as this would offer an easily exploitable way to
subvert the accounts of users of the revision control system. No comments
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With