This is exactly what hooks are for. You would need a precommit
hook on every repo or possibly the pretxnchangegroup
.
By creating a precommit
hook (script) that checks for a specific file or a specific change, you can fail the commit and print out whatever warning you need. The return value of the script indicates to mercurial if the transaction is valid or not.
Use the following generic sample to check for the presence of certain files that would be committed, before accepting or rejecting the changesets.