How can I prevent someone from pushing multiple heads?

I have colleagues who press multiple heads using the --force switch because they did not merge properly.

Are there any ways to prevent this?

+4
source share
5 answers

You can do this with a server side pretxnchangegroup hook.

Here are some examples: http://www.softwareprojects.com/resources/programming/t-mercurial-hook-forbid-2-heads-1910.html

All these hooks are used to make sure that after the change group is applied, there is still only one head (or only one per branch, if you want a fantasy).

+7
source

Tell them that they should not do this, and apply the workflow using sniffers in a managed repository.

At work, we limit it to one head / branch. Essentially replace forbid_2head.sh as follows:

 #!/bin/bash # Ensure only one head per branch in hg repository for BRANCH in `hg branches -qa` do COUNT=`hg heads -q $BRANCH | wc -l` if [ "$COUNT" -ne "1" ] ; then echo "Error: Trying to push more than one head to branch $BRANCH." exit 1 fi done exit 0 
+2
source

This is the best from the best experienced developers: http://hg.python.org/hooks/file/default/checkheads.py

Visit http://hg.python.org/hooks/file/default/ for a list of other useful hooks.

+2
source

You can revoke your transfer rights to the repository where they are located --force ing, and force them to click on another server or send changes through the patch.

+1
source

First, I would tell the developers that force clicks are not allowed.

I would also use the solution for connecting to the server side, as described above, and on the hook add an email to everyone, indicating that WHO tried to push several goals into the central repo [and then format its hard drive;)]

0
source

All Articles