You can do it with a hook, but you're going to find it more trouble than just creating a clear README.txt. :)
The hook would look like:
[hooks]
post-clone = cp -i config.ini.sample config.ini
As Paul Fischer pointed out, it's better to use a .sample
that's in the repo than something like /home/configs/config.ini
that's out of the repo.
The problem, as VonC points out, is that hooks aren't copied down on clone -- and for good reason: if cloning brought down hooks too then I'd put post-clone = rm -rf ~
in there are really ruin your day.
So if you're set on using a hook the way around it is to put the hook somewhere outside the repo. In a corporate setting you can do that in the /etc/mercurial/hgrc
file on all systems, which if you have a decent IT setup they can do centrally. Since it sounds like you're sure there will be a /home/configs user dir it sounds like you might be talking about all the clones being on a single machine, which case this is a fine option for you. However, in an more decentralized environment you're back to having each person manually install the hook you want in their own ~/.hgrc
, and at that point you might as well just have them do the copy themselves.
One idea worth considering is checking if whatever is interpreting your config.ini
file has an include
-like directive? Then you could have the cloned-down config.ini
looks like:
... some stuff
%include /home/configs/config.ini
... more stuff
In which case no copy is necessary at all. Mercurial, for example, does have an include directive which works just like that: http://www.selenic.com/mercurial/hgrc.5.html#syntax