grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Fix a typo in the readme
24 months ago, Gary Kramlich
a2f020bc5a00
Fix a typo in the readme
package
commands
import
(
"fmt"
"path/filepath"
"github.com/gliderlabs/ssh"
log
"github.com/sirupsen/logrus"
"keep.imfreedom.org/grim/hgkeeper/access"
"keep.imfreedom.org/grim/hgkeeper/hg"
)
type
Init
struct
{
repoPath
string
repoName
string
}
func
NewInit
(
reposPath
,
repoName
string
)
*
Init
{
return
&
Init
{
repoPath
:
filepath
.
Join
(
reposPath
,
repoName
),
repoName
:
repoName
,
}
}
func
(
i
*
Init
)
Run
(
session
ssh
.
Session
,
username
string
)
error
{
if
!
access
.
CanInit
(
username
,
"/"
+
i
.
repoName
)
{
return
fmt
.
Errorf
(
"access denied"
)
}
if
err
:=
run
(
i
.
repoPath
,
username
,
hg
.
Init
(
i
.
repoPath
),
session
);
err
!=
nil
{
return
err
}
log
.
Info
(
"refreshing access control for new repo"
)
return
access
.
Refresh
()
}