--- a/globals/globals.go Wed Jan 04 07:29:10 2023 -0600
+++ b/globals/globals.go Tue Mar 14 18:00:18 2023 -0500
@@ -1,6 +1,7 @@
- ReposPath string `kong:"flag,name='repos-path',env='HGK_REPOS_PATH',default='repos',help='the directory where the repositories are stored'"`
- AdminRepo string `kong:"flag,name='admin-repo',env='HGK_ADMIN_REPO',default='hgkeeper',help='the name of the admin repo to create/use'"`
+ HgExecutable string `kong:"flag,name='hg-exe',env='HGK_HG_EXE',default='hg',help='The hg executable to use. This can be a relative or absolute path.'"` + ReposPath string `kong:"flag,name='repos-path',env='HGK_REPOS_PATH',default='repos',help='the directory where the repositories are stored'"` + AdminRepo string `kong:"flag,name='admin-repo',env='HGK_ADMIN_REPO',default='hgkeeper',help='the name of the admin repo to create/use'"` --- a/hg/hg.go Wed Jan 04 07:29:10 2023 -0600
+++ b/hg/hg.go Tue Mar 14 18:00:18 2023 -0500
@@ -1,6 +1,7 @@
@@ -13,12 +14,29 @@
"keep.imfreedom.org/grim/hgkeeper/access"
+func SetExe(path string) error { + path, err := exec.LookPath(path) + if !errors.Is(err, exec.ErrDot) { func (c *Command) Setup(repoName, username string) error {
hgrc, err := createHgrc(c.writeable)
@@ -127,13 +145,13 @@
func Init(path string) *Command {
- cmd: exec.Command("hg", "init", path),
+ cmd: exec.Command(hgExe, "init", path), func Serve(path string, writeable bool) *Command {
- cmd: exec.Command("hg", "-R", path, "serve", "--stdio"),
+ cmd: exec.Command(hgExe, "-R", path, "serve", "--stdio"), @@ -142,7 +160,7 @@
args := append([]string{"add", "--cwd", path}, files...)
- cmd: exec.Command("hg", args...),
+ cmd: exec.Command(hgExe, args...), @@ -155,7 +173,7 @@
- cmd: exec.Command("hg", args...),
+ cmd: exec.Command(hgExe, args...), @@ -166,6 +184,6 @@
- cmd: exec.Command("hg", args...),
+ cmd: exec.Command(hgExe, args...), --- a/main.go Wed Jan 04 07:29:10 2023 -0600
+++ b/main.go Tue Mar 14 18:00:18 2023 -0500
@@ -8,6 +8,7 @@
"keep.imfreedom.org/grim/hgkeeper/authorized_keys"
"keep.imfreedom.org/grim/hgkeeper/globals"
+ "keep.imfreedom.org/grim/hgkeeper/hg" "keep.imfreedom.org/grim/hgkeeper/once"
"keep.imfreedom.org/grim/hgkeeper/serve"
"keep.imfreedom.org/grim/hgkeeper/setup"
@@ -43,6 +44,10 @@
+ if err := hg.SetExe(cmd.Globals.HgExecutable); err != nil { if err := ctx.Run(&cmd.Globals); err != nil {