Enforcing at most one unbookmarked head on default branch

7 views
Skip to first unread message

Jens Peter Secher

unread,
Sep 15, 2012, 12:01:28 PM9/15/12
to merc...@selenic.com
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?
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial
Reply all
Reply to author
Forward
0 new messages