I'm using server-side (remote) hooks to prevent specific kind of pushes.
Among other thing, I want to ban pushes that are creating new heads in mercurial repository even if they were pushed with --force
.
I can think only of one way to achieve this: just iterate through ancestors and fail on first ancestor that has two children.
This approach actually works, but I'll be very glad if someone can show me a more elegant way of achieving the same.
OK, so it turns out it's done much easier than I've anticipated. Basically all you need is to check for the number of head in the repo repo object, so: