Search code examples
mercurialglobalmercurial-hook

mercurial: is there a remote global hook?


On my remote server that hosts all mercurial repos (+100) I want to define a global hook. That is, after a commit to any of the repos a certain action is suppose to take place (actually a post request should be triggered).

I know that I can define a hook in every single repo but considering the amount of repos this not an option. Is there a way to define the hook globally?


Solution

  • On a 'remote' server everything works the same as on your local machine.

    Anything which is supposed to work for every repository can be controlled by your global config file (~/.hgrc or %USERPROFILE%\mercurial.ini). Thus if all repositories are owned by the same user on the server, then add those hook(s) to its ~/.hgrc. There are other places for system-wide configuration files. Excerpt from hg help config (unix paths):

    - "<repo>/.hg/hgrc" (per-repository)
    - "$HOME/.hgrc" (per-user)
    - "<install-root>/etc/mercurial/hgrc" (per-installation)
    - "<install-root>/etc/mercurial/hgrc.d/*.rc" (per-installation)
    - "/etc/mercurial/hgrc" (per-system)
    - "/etc/mercurial/hgrc.d/*.rc" (per-system)
    - "<internal>/default.d/*.rc" (defaults)