grim/hgkeeper

Add a caching layer to the hgweb portion. This should take some strain off of mercurial anf our cpu quota
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
}