grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Serve all static files from /static and handle it from go instead of passing it to python. Fixes HGKEEPER-7
2020-04-24, Gary Kramlich
fbcab4551b60
Serve all static files from /static and handle it from go instead of passing it to python. Fixes HGKEEPER-7
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
}