grim/hgkeeper

76eb73c033fc
Wire up permissions still need to handle readonly
package hg
import (
"os"
"os/exec"
)
func common(cmd *exec.Cmd) *exec.Cmd {
cmd.Env = append(os.Environ(), "HGRCPATH=/dev/null")
return cmd
}
func Init(path string) *exec.Cmd {
return common(exec.Command("hg", "init", path))
}
func Serve(path string) *exec.Cmd {
return common(exec.Command("hg", "-R", path, "serve", "--stdio"))
}
func Add(path string, files ...string) *exec.Cmd {
args := append([]string{"add", "--cwd", path}, files...)
return common(exec.Command("hg", args...))
}
func Commit(path, username, message string) *exec.Cmd {
args := []string{
"commit",
"--cwd", path,
"--config", "ui.username=" + username,
"-m", message,
}
return common(exec.Command("hg", args...))
}