diff options
author | 6543 <6543@obermui.de> | 2021-01-21 20:33:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 20:33:58 +0100 |
commit | 81c833d92d04e0a5579e7168aba548dad7e17451 (patch) | |
tree | c928f1b43fc6e2f27603193f0eed657f0760c96d /modules/migrations/gitea_uploader.go | |
parent | b5570d3e680570343c1552bfc972b19b161209cd (diff) | |
download | gitea-81c833d92d04e0a5579e7168aba548dad7e17451.tar.gz gitea-81c833d92d04e0a5579e7168aba548dad7e17451.zip |
Add support to migrate from gogs (#14342)
Add support to migrate gogs:
* issues
* comments
* labels
* milestones
* wiki
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/migrations/gitea_uploader.go')
-rw-r--r-- | modules/migrations/gitea_uploader.go | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/modules/migrations/gitea_uploader.go b/modules/migrations/gitea_uploader.go index 2c79bd4b0f..3be49b5c6c 100644 --- a/modules/migrations/gitea_uploader.go +++ b/modules/migrations/gitea_uploader.go @@ -10,7 +10,6 @@ import ( "context" "fmt" "io" - "net/url" "os" "path/filepath" "strings" @@ -86,22 +85,6 @@ func (g *GiteaLocalUploader) MaxBatchInsertSize(tp string) int { return 10 } -func fullURL(opts base.MigrateOptions, remoteAddr string) (string, error) { - var fullRemoteAddr = remoteAddr - if len(opts.AuthToken) > 0 || len(opts.AuthUsername) > 0 { - u, err := url.Parse(remoteAddr) - if err != nil { - return "", err - } - u.User = url.UserPassword(opts.AuthUsername, opts.AuthPassword) - if len(opts.AuthToken) > 0 { - u.User = url.UserPassword("oauth2", opts.AuthToken) - } - fullRemoteAddr = u.String() - } - return fullRemoteAddr, nil -} - // CreateRepo creates a repository func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.MigrateOptions) error { owner, err := models.GetUserByName(g.repoOwner) @@ -109,10 +92,6 @@ func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.Migrate return err } - remoteAddr, err := fullURL(opts, repo.CloneURL) - if err != nil { - return err - } var r *models.Repository if opts.MigrateToRepoID <= 0 { r, err = repo_module.CreateRepository(g.doer, owner, models.CreateRepoOptions{ @@ -138,7 +117,7 @@ func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.Migrate OriginalURL: repo.OriginalURL, GitServiceType: opts.GitServiceType, Mirror: repo.IsMirror, - CloneAddr: remoteAddr, + CloneAddr: repo.CloneURL, Private: repo.IsPrivate, Wiki: opts.Wiki, Releases: opts.Releases, // if didn't get releases, then sync them from tags |