grim/hgkeeper

auto reload the access model and policy if the admin repo is accessed. This does both push and pulls right now.
package hg
import (
"io/ioutil"
"gopkg.in/ini.v1"
)
func createHgrc(writeable bool) (string, error) {
tmpfile, err := ioutil.TempFile("", "hgkeeper-*.hgrc")
if err != nil {
return "", err
}
hgrc := ini.Empty()
if !writeable {
hooks, err := hgrc.NewSection("hooks")
if err != nil {
return "", err
}
hooks.NewKey("pretxnchangegroup", "/bin/false")
}
if err := hgrc.SaveTo(tmpfile.Name()); err != nil {
return "", err
}
return tmpfile.Name(), nil
}