本站源代码
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

75 líneas
2.0KB

  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package migrations
  5. import (
  6. "code.gitea.io/gitea/modules/migrations/base"
  7. )
  8. var (
  9. _ base.Downloader = &PlainGitDownloader{}
  10. )
  11. // PlainGitDownloader implements a Downloader interface to clone git from a http/https URL
  12. type PlainGitDownloader struct {
  13. ownerName string
  14. repoName string
  15. remoteURL string
  16. }
  17. // NewPlainGitDownloader creates a git Downloader
  18. func NewPlainGitDownloader(ownerName, repoName, remoteURL string) *PlainGitDownloader {
  19. return &PlainGitDownloader{
  20. ownerName: ownerName,
  21. repoName: repoName,
  22. remoteURL: remoteURL,
  23. }
  24. }
  25. // GetRepoInfo returns a repository information
  26. func (g *PlainGitDownloader) GetRepoInfo() (*base.Repository, error) {
  27. // convert github repo to stand Repo
  28. return &base.Repository{
  29. Owner: g.ownerName,
  30. Name: g.repoName,
  31. CloneURL: g.remoteURL,
  32. }, nil
  33. }
  34. // GetTopics returns empty list for plain git repo
  35. func (g *PlainGitDownloader) GetTopics() ([]string, error) {
  36. return []string{}, nil
  37. }
  38. // GetMilestones returns milestones
  39. func (g *PlainGitDownloader) GetMilestones() ([]*base.Milestone, error) {
  40. return nil, ErrNotSupported
  41. }
  42. // GetLabels returns labels
  43. func (g *PlainGitDownloader) GetLabels() ([]*base.Label, error) {
  44. return nil, ErrNotSupported
  45. }
  46. // GetReleases returns releases
  47. func (g *PlainGitDownloader) GetReleases() ([]*base.Release, error) {
  48. return nil, ErrNotSupported
  49. }
  50. // GetIssues returns issues according page and perPage
  51. func (g *PlainGitDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error) {
  52. return nil, false, ErrNotSupported
  53. }
  54. // GetComments returns comments according issueNumber
  55. func (g *PlainGitDownloader) GetComments(issueNumber int64) ([]*base.Comment, error) {
  56. return nil, ErrNotSupported
  57. }
  58. // GetPullRequests returns pull requests according page and perPage
  59. func (g *PlainGitDownloader) GetPullRequests(start, limit int) ([]*base.PullRequest, error) {
  60. return nil, ErrNotSupported
  61. }
上海开阖软件有限公司 沪ICP备12045867号-1