Add sync items to Mirror struct

This commit is contained in:
harryzcy 2022-07-22 05:09:05 -04:00
parent 4f67c5d5ca
commit bbd464857c
No known key found for this signature in database
GPG Key ID: CC2953E050C19686
2 changed files with 20 additions and 5 deletions

View File

@ -27,6 +27,14 @@ type Mirror struct {
Interval time.Duration
EnablePrune bool `xorm:"NOT NULL DEFAULT true"`
SyncWiki bool
SyncIssues bool
SyncMilestones bool
SyncLabels bool
SyncReleases bool
SyncComments bool
SyncPullRequests bool
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX"`
NextUpdateUnix timeutil.TimeStamp `xorm:"INDEX"`

View File

@ -177,11 +177,18 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User,
if opts.Mirror {
mirrorModel := repo_model.Mirror{
RepoID: repo.ID,
Interval: setting.Mirror.DefaultInterval,
EnablePrune: true,
NextUpdateUnix: timeutil.TimeStampNow().AddDuration(setting.Mirror.DefaultInterval),
LFS: opts.LFS,
RepoID: repo.ID,
Interval: setting.Mirror.DefaultInterval,
SyncWiki: opts.Wiki,
SyncIssues: opts.Issues,
SyncMilestones: opts.Milestones,
SyncLabels: opts.Labels,
SyncReleases: opts.Releases,
SyncComments: opts.Comments,
SyncPullRequests: opts.PullRequests,
EnablePrune: true,
NextUpdateUnix: timeutil.TimeStampNow().AddDuration(setting.Mirror.DefaultInterval),
LFS: opts.LFS,
}
if opts.LFS {
mirrorModel.LFSEndpoint = opts.LFSEndpoint