You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

git.go 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. // GetMilestones returns milestones
  35. func (g *PlainGitDownloader) GetMilestones() ([]*base.Milestone, error) {
  36. return nil, ErrNotSupported
  37. }
  38. // GetLabels returns labels
  39. func (g *PlainGitDownloader) GetLabels() ([]*base.Label, error) {
  40. return nil, ErrNotSupported
  41. }
  42. // GetReleases returns releases
  43. func (g *PlainGitDownloader) GetReleases() ([]*base.Release, error) {
  44. return nil, ErrNotSupported
  45. }
  46. // GetIssues returns issues according page and perPage
  47. func (g *PlainGitDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error) {
  48. return nil, false, ErrNotSupported
  49. }
  50. // GetComments returns comments according issueNumber
  51. func (g *PlainGitDownloader) GetComments(issueNumber int64) ([]*base.Comment, error) {
  52. return nil, ErrNotSupported
  53. }
  54. // GetPullRequests returns pull requests according page and perPage
  55. func (g *PlainGitDownloader) GetPullRequests(start, limit int) ([]*base.PullRequest, error) {
  56. return nil, ErrNotSupported
  57. }