2019-05-07 06:42:51 +05:30
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2019-05-07 06:42:51 +05:30
|
|
|
|
|
|
|
package migrations
|
|
|
|
|
|
|
|
import (
|
2019-12-17 09:46:54 +05:30
|
|
|
"context"
|
|
|
|
|
2021-11-16 20:55:33 +05:30
|
|
|
base "code.gitea.io/gitea/modules/migration"
|
2019-05-07 06:42:51 +05:30
|
|
|
)
|
|
|
|
|
2022-01-20 23:16:10 +05:30
|
|
|
var _ base.Downloader = &PlainGitDownloader{}
|
2019-05-07 06:42:51 +05:30
|
|
|
|
|
|
|
// PlainGitDownloader implements a Downloader interface to clone git from a http/https URL
|
|
|
|
type PlainGitDownloader struct {
|
2021-01-22 01:03:58 +05:30
|
|
|
base.NullDownloader
|
2019-05-07 06:42:51 +05:30
|
|
|
ownerName string
|
|
|
|
repoName string
|
|
|
|
remoteURL string
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewPlainGitDownloader creates a git Downloader
|
|
|
|
func NewPlainGitDownloader(ownerName, repoName, remoteURL string) *PlainGitDownloader {
|
|
|
|
return &PlainGitDownloader{
|
|
|
|
ownerName: ownerName,
|
|
|
|
repoName: repoName,
|
|
|
|
remoteURL: remoteURL,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-17 09:46:54 +05:30
|
|
|
// SetContext set context
|
|
|
|
func (g *PlainGitDownloader) SetContext(ctx context.Context) {
|
|
|
|
}
|
|
|
|
|
2019-05-07 06:42:51 +05:30
|
|
|
// GetRepoInfo returns a repository information
|
|
|
|
func (g *PlainGitDownloader) GetRepoInfo() (*base.Repository, error) {
|
|
|
|
// convert github repo to stand Repo
|
|
|
|
return &base.Repository{
|
|
|
|
Owner: g.ownerName,
|
|
|
|
Name: g.repoName,
|
|
|
|
CloneURL: g.remoteURL,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-01-22 01:03:58 +05:30
|
|
|
// GetTopics return empty string slice
|
|
|
|
func (g PlainGitDownloader) GetTopics() ([]string, error) {
|
2019-08-14 11:46:12 +05:30
|
|
|
return []string{}, nil
|
|
|
|
}
|