Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set up a hook in HG / Mercurial that gets dictated by the repository?

I have a need for a hook to run after update (this will build the solution they have updated) and I don't want to have to add that hook manually for each person that clones my central repository.

When someone first clones my central repository, is it possible to include hooks into that clone? It seems that the .hgrc file doesn't get cloned automatically.

I did read about site-wide hooks, but as far as I understand it, they work on each created repository, where I only want to have the hooks on some repos.

like image 785
sebastiaan Avatar asked Dec 03 '22 01:12

sebastiaan


1 Answers

As Rudi already said, this is (thankfully) not possible for security reasons.

However, you can reduce the per-clone workload to set up hooks manually: Ship the hook scripts as part of your repository, e.g. in a directory .hghooks, and additionally include a script in your repo which sets up these hooks in a clone's hgrc. Each coworker now only needs to call the setup script once per clone.

like image 115
Oben Sonne Avatar answered Dec 29 '22 00:12

Oben Sonne