diff options
author | John Olheiser <john.olheiser@gmail.com> | 2020-08-27 20:36:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 09:36:37 +0800 |
commit | 211321fb936683815c4033fdfb9ac46af8a3b357 (patch) | |
tree | 13f356084062e1827bda3ba0d1c9f4b4b5c2c799 /modules/structs/repo.go | |
parent | ed2f6e137be8fe3c85292e8344b5bb5cfb56891d (diff) | |
download | gitea-211321fb936683815c4033fdfb9ac46af8a3b357.tar.gz gitea-211321fb936683815c4033fdfb9ac46af8a3b357.zip |
Git migration UX (#12619)
* Initial work
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Implementation
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix gitlab and token cloning
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Imports and JS
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix test
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Linting
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Generate swagger
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move mirror toggle and rename options
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/structs/repo.go')
-rw-r--r-- | modules/structs/repo.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 217a6f74ad..808d2ffbc8 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -218,6 +218,32 @@ func (gt GitServiceType) Name() string { return "" } +// Title represents the service type's proper title +func (gt GitServiceType) Title() string { + switch gt { + case GithubService: + return "GitHub" + case GiteaService: + return "Gitea" + case GitlabService: + return "GitLab" + case GogsService: + return "Gogs" + case PlainGitService: + return "Git" + } + return "" +} + +// TokenAuth represents whether a service type supports token-based auth +func (gt GitServiceType) TokenAuth() bool { + switch gt { + case GithubService, GiteaService, GitlabService: + return true + } + return false +} + var ( // SupportedFullGitService represents all git services supported to migrate issues/labels/prs and etc. // TODO: add to this list after new git service added @@ -233,6 +259,7 @@ type MigrateRepoOption struct { CloneAddr string `json:"clone_addr" binding:"Required"` AuthUsername string `json:"auth_username"` AuthPassword string `json:"auth_password"` + AuthToken string `json:"auth_token"` // required: true UID int `json:"uid" binding:"Required"` // required: true |