Enforcing at most one unbookmarked head on default branch
Jens Peter Secher
jpsecher at gmail.com
Sat Sep 15 16:01:28 UTC 2012
I am trying to figure out how to enforce a policy of at most one
unbookmarked head on the default branch. On the central repository I have
[hooks]
pretxnchangegroup = .hg/validate $HG_NODE
where the validate script is
#!/bin/sh
HEADSWOBOOKMARK=`hg log --template '{node|short} ' -r 'head() &
branch(default) & !bookmark()'`
if [ `echo "$HEADSWOBOOKMARK" | wc -w` -gt 1 ]
then
echo "Only one unbookmarked head allowed on default branch."
for n in $HEADSWOBOOKMARK
do
echo " $n has no bookmark"
done
exit 1
fi
exit 0
But it does not work when doing e.g.
$ hg push -B feature1 -f
because apparently the new bookmark feature1 is not visible when
pretxnchangegroup is run.
Is there a way to achieve what I want?
Cheers,
/JP
--
Jens Peter Secher, GPG fingerprint 0EE5978AFE63E8A1.
A. Because it breaks the logical sequence of discussion.
Q. Why is top posting bad?
More information about the Mercurial
mailing list