1

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.

abu
  • 11
  • 5

2 Answers2

0

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.

planetmaker
  • 5,884
  • 3
  • 28
  • 37
  • Yep, that was the solution: https://www.mercurial-scm.org/wiki/HookExamples#pretxnchangegroup:_enforce_the_stable_branch_to_contains_only_merge_commits_on_the_server – abu Mar 01 '17 at 10:25
0

Based on @planetmaker's idea I found a hook what can help me: https://www.mercurial-scm.org/wiki/HookExamples#pretxnchangegroup:_enforce_the_stable_branch_to_contains_only_merge_commits_on_the_server

abu
  • 11
  • 5