mirror of https://github.com/go-gitea/gitea.git
* Only sync tags after all batches (#9319) Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add SyncTags to uploader interface (#9326) * Add sync tags to interface Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix revive Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
f11df80058
commit
9ef148abeb
|
@ -12,6 +12,7 @@ type Uploader interface {
|
||||||
CreateTopics(topic ...string) error
|
CreateTopics(topic ...string) error
|
||||||
CreateMilestones(milestones ...*Milestone) error
|
CreateMilestones(milestones ...*Milestone) error
|
||||||
CreateReleases(releases ...*Release) error
|
CreateReleases(releases ...*Release) error
|
||||||
|
SyncTags() error
|
||||||
CreateLabels(labels ...*Label) error
|
CreateLabels(labels ...*Label) error
|
||||||
CreateIssues(issues ...*Issue) error
|
CreateIssues(issues ...*Issue) error
|
||||||
CreateComments(comments ...*Comment) error
|
CreateComments(comments ...*Comment) error
|
||||||
|
|
|
@ -288,11 +288,12 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error {
|
||||||
|
|
||||||
rels = append(rels, &rel)
|
rels = append(rels, &rel)
|
||||||
}
|
}
|
||||||
if err := models.InsertReleases(rels...); err != nil {
|
|
||||||
return err
|
return models.InsertReleases(rels...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// sync tags to releases in database
|
// SyncTags syncs releases with tags in the database
|
||||||
|
func (g *GiteaLocalUploader) SyncTags() error {
|
||||||
return models.SyncReleasesWithTags(g.repo, g.gitRepo)
|
return models.SyncReleasesWithTags(g.repo, g.gitRepo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,11 @@ func migrateRepository(downloader base.Downloader, uploader base.Uploader, opts
|
||||||
}
|
}
|
||||||
releases = releases[relBatchSize:]
|
releases = releases[relBatchSize:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Once all releases (if any) are inserted, sync any remaining non-release tags
|
||||||
|
if err := uploader.SyncTags(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var commentBatchSize = uploader.MaxBatchInsertSize("comment")
|
var commentBatchSize = uploader.MaxBatchInsertSize("comment")
|
||||||
|
|
Loading…
Reference in New Issue