Search code examples
mercurialmercurial-hook

Mercurial: enable merge but forbid commit


How can I forbid commits and allow merges into specific branch?

eg. master branch can't be complete with a commit but can with merge.


Solution

  • If you want to allow only merges in a branch, check in the hook whether every commit for that branch has two parents - and reject the incoming changes if it has only one.