grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Add `go 1.11` to the bottom of go.mod and run `go mod tidy`
2019-09-10, Gary Kramlich
21e7408ca1a0
Add `go 1.11` to the bottom of go.mod and run `go mod tidy`
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
}