grim/hgkeeper

Add hgweb support
feature/hgweb
2019-12-17, Gary Kramlich
8d3f0cd8203a
Add hgweb support
package commands
import (
"fmt"
"path/filepath"
"github.com/gliderlabs/ssh"
"bitbucket.org/rw_grim/hgkeeper/access"
"bitbucket.org/rw_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")
}
return run(hg.Init(i.repoPath), session)
}