Evil hack: make it so it instead uses the Debian package.
#!/bin/sh
set -e
cd
cat > .ssh/config <<__END__
Host chroothg
Hostname localhost
User hg
Port 2222
__END__
hg clone ssh://chroothg/hgadmin
cd hgadmin
mkdir -p keys/users
cp /home/test2/.ssh/id_rsa.pub keys/users/test2
hg add keys/users/test2
hg commit -u test1 -m "Added user test2"
hg push
cd ..
mkdir realrepo
cd realrepo
hg init .
echo "This is a file" > content
hg add content
hg commit -u test1 -m "Add a file to the repo"
hg clone . ssh://chroothg/real/project