grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Remove the mercurial 6.1 pin from the container image
22 months ago, Gary Kramlich
653b933ba715
Remove the mercurial 6.1 pin from the container image
package
hg
import
(
"fmt"
"os/exec"
"strings"
log
"github.com/sirupsen/logrus"
)
func
TemplatesDir
()
(
string
,
error
)
{
templatesDir
,
err
:=
Config
(
"web.templates"
).
Exec
(
""
,
""
)
if
err
!=
nil
||
templatesDir
==
""
{
if
err
!=
nil
{
log
.
Warnf
(
"failed to read web.templates setting from hg: %v"
,
err
)
}
args
:=
[]
string
{
"/usr/bin/env"
,
"python3"
,
"-c"
,
"from mercurial import templater; print(templater.templatedir().decode('UTF-8'))"
,
}
cmd
:=
exec
.
Command
(
args
[
0
],
args
[
1
:]
...
)
raw
,
err
:=
cmd
.
CombinedOutput
()
if
err
!=
nil
{
log
.
Debugf
(
"raw: %#v\n"
,
string
(
raw
))
return
""
,
err
}
templatesDir
=
strings
.
TrimSpace
(
string
(
raw
))
if
templatesDir
==
""
{
return
""
,
fmt
.
Errorf
(
"failed to find the templates directory"
)
}
log
.
Infof
(
"using %s as the templates directory\n"
,
templatesDir
)
}
return
templatesDir
,
nil
}