forked from forgejo/forgejo
* Add migrate repo archiver and packages storage support on command line (#20757) * Add migrate repo archiver and packages storage support on command line * Fix typo * Use stdCtx * Use packageblob and fix command description * Add migrate packages unit tests * Fix comment year * Fix the migrate storage command line description * Update cmd/migrate_storage.go Co-authored-by: zeripath <art27@cantab.net> * Update cmd/migrate_storage.go Co-authored-by: zeripath <art27@cantab.net> * Update cmd/migrate_storage.go Co-authored-by: zeripath <art27@cantab.net> * Fix test Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net> * bug fix Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
b43d7e1254
commit
7a9b01a2dd
11 changed files with 189 additions and 136 deletions
|
@ -278,29 +278,6 @@ func LFSAutoAssociate(metas []*LFSMetaObject, user *user_model.User, repoID int6
|
|||
return committer.Commit()
|
||||
}
|
||||
|
||||
// IterateLFS iterates lfs object
|
||||
func IterateLFS(f func(mo *LFSMetaObject) error) error {
|
||||
var start int
|
||||
const batchSize = 100
|
||||
e := db.GetEngine(db.DefaultContext)
|
||||
for {
|
||||
mos := make([]*LFSMetaObject, 0, batchSize)
|
||||
if err := e.Limit(batchSize, start).Find(&mos); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(mos) == 0 {
|
||||
return nil
|
||||
}
|
||||
start += len(mos)
|
||||
|
||||
for _, mo := range mos {
|
||||
if err := f(mo); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CopyLFS copies LFS data from one repo to another
|
||||
func CopyLFS(ctx context.Context, newRepo, oldRepo *repo_model.Repository) error {
|
||||
var lfsObjects []*LFSMetaObject
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue