Here is a simple server side hook that will do what you want:
## [hooks]# pretxnchangegroup.heads = python:hooks.headshook#defheadshook(ui,repo,**kwargs):"""Check that no branch has more than one head"""ret=Noneforbranch,headsinrepo.branchmap().iteritems():iflen(heads)>1:ui.warn('abort: branch "%s" would have more than one head after push\n'%branch)ui.status('hint: use "hg merge" to merge nodes %s and %s\n'%(repo[heads],repo[heads]))ret=Truereturnret
It would be nice though to have a way to upload / edit hooks and set them in the hgrc through SCM-Manager so that you wouldn't need to SSH / RDP into the server to change them.
Good one hook, but it will be much more better to have an option.
I'm also interested in this one. Is there an easy way to have python hooks like this be active on all repositories (and all new ones that are created)? If an scm-manager plugin is needed for this, is there any example plugin that could be looked at?
For the windows registry key, it needs to be a list of paths to Mercurial.ini file or directories containing .rc files. The best locations to use IMHO are "%AllUsersProfile%\Mercurial.ini" and "%AllUsersProfile%\hgrc.d\".