mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-02 13:44:16 +09:00
Adds migration from bitbucket.org as the Cloud variant of the Bitbucket entry, in the web UI and via `POST /repos/migrate` with `service=bitbucket`. It migrates the repository and pull requests with their comments and reviews. Bitbucket Cloud has no releases, and Atlassian removed its issues and wikis on 2026-08-20 (https://community.atlassian.com/forums/Bitbucket-articles/Announcing-sunset-of-Bitbucket-Issues-and-Wikis/ba-p/3193882). - Private repositories need an API or access token, which also raises the rate limit. - Rate-limited requests back off and retry, Bitbucket sends no `Retry-After`. - Tests replay recorded responses, set `BITBUCKET_READ_TOKEN` to re-record. Co-authored-by: silverwind <me@silverwind.io>
53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// Copyright 2016 The Gogs Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package convert
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"gitea.dev/modules/setting"
|
|
"gitea.dev/modules/structs"
|
|
)
|
|
|
|
// ToCorrectPageSize makes sure page size is in allowed range.
|
|
func ToCorrectPageSize(size int) int {
|
|
if size <= 0 {
|
|
size = setting.API.DefaultPagingNum
|
|
} else if size > setting.API.MaxResponseItems {
|
|
size = setting.API.MaxResponseItems
|
|
}
|
|
return size
|
|
}
|
|
|
|
// ToGitServiceType return GitServiceType based on string
|
|
func ToGitServiceType(value string) structs.GitServiceType {
|
|
switch strings.ToLower(value) {
|
|
case "github":
|
|
return structs.GithubService
|
|
case "gitea":
|
|
return structs.GiteaService
|
|
case "gitlab":
|
|
return structs.GitlabService
|
|
case "gogs":
|
|
return structs.GogsService
|
|
case "onedev":
|
|
return structs.OneDevService
|
|
case "gitbucket":
|
|
return structs.GitBucketService
|
|
case "codebase":
|
|
return structs.CodebaseService
|
|
case "codecommit":
|
|
return structs.CodeCommitService
|
|
case "bitbucketserver":
|
|
return structs.BitbucketServerService
|
|
case "forgejo":
|
|
return structs.ForgejoService
|
|
case "bitbucket":
|
|
return structs.BitbucketService
|
|
default:
|
|
return structs.PlainGitService
|
|
}
|
|
}
|