Кирилл Горбунов
eb2a21a1b1
Убрана кобра, доработаны методы создания, закрытия пулл реквестов. Co-authored-by: Gorbunov Kirill Andreevich <kgorbunov@mtsbank.ru> Reviewed-on: #11 Co-authored-by: Кирилл Горбунов <kirya_gorbunov_2015@mail.ru> Co-committed-by: Кирилл Горбунов <kirya_gorbunov_2015@mail.ru>
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package source
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.unistack.org/unistack-org/pkgdash/internal/configcli"
|
|
"git.unistack.org/unistack-org/pkgdash/internal/modules"
|
|
"git.unistack.org/unistack-org/pkgdash/internal/source/gitea"
|
|
"git.unistack.org/unistack-org/pkgdash/internal/source/github"
|
|
"git.unistack.org/unistack-org/pkgdash/internal/source/gitlab"
|
|
"git.unistack.org/unistack-org/pkgdash/internal/source/gogs"
|
|
)
|
|
|
|
type SourceControl interface {
|
|
Name() string
|
|
RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error
|
|
RequestClose(ctx context.Context, branch string, path string) error
|
|
RequestUpdate(ctx context.Context, branch string, path string, mod modules.Update) error
|
|
RequestList(ctx context.Context, branch string) (map[string]string, error)
|
|
}
|
|
|
|
func NewSourceControl(cfg configcli.Config) SourceControl {
|
|
switch cfg.Source.TypeGit {
|
|
case "github":
|
|
return github.NewGithub(cfg)
|
|
case "gitlab":
|
|
return gitlab.NewGitlab(cfg)
|
|
case "gitea":
|
|
return gitea.NewGitea(cfg)
|
|
case "gogs":
|
|
return gogs.NewGogs(cfg)
|
|
}
|
|
return nil
|
|
}
|