loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'cmd/dump: add option flag to skip repository archives' (#6387) from c8h4/forgejo:dump-skip-repo-archive into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6387
Reviewed-by: Gusted <gusted@noreply.codeberg.org>

Gusted d071c09b 3870acbd

+27 -17
+27 -17
cmd/dump.go
··· 133 133 &cli.BoolFlag{ 134 134 Name: "skip-repository", 135 135 Aliases: []string{"R"}, 136 - Usage: "Skip the repository dumping", 136 + Usage: "Skip repositories", 137 137 }, 138 138 &cli.BoolFlag{ 139 139 Name: "skip-log", 140 140 Aliases: []string{"L"}, 141 - Usage: "Skip the log dumping", 141 + Usage: "Skip logs", 142 142 }, 143 143 &cli.BoolFlag{ 144 144 Name: "skip-custom-dir", ··· 159 159 &cli.BoolFlag{ 160 160 Name: "skip-index", 161 161 Usage: "Skip bleve index data", 162 + }, 163 + &cli.BoolFlag{ 164 + Name: "skip-repo-archives", 165 + Usage: "Skip repository archives", 162 166 }, 163 167 &cli.GenericFlag{ 164 168 Name: "type", ··· 233 237 if file == nil { 234 238 file, err = os.Create(fileName) 235 239 if err != nil { 236 - fatal("Unable to open %s: %v", fileName, err) 240 + fatal("Failed to open %s: %v", fileName, err) 237 241 } 238 242 } 239 243 defer file.Close() ··· 250 254 iface, err = archiver.ByExtension(fileName) 251 255 } 252 256 if err != nil { 253 - fatal("Unable to get archiver for extension: %v", err) 257 + fatal("Failed to get archiver for extension: %v", err) 254 258 } 255 259 256 260 w, _ := iface.(archiver.Writer) ··· 260 264 defer w.Close() 261 265 262 266 if ctx.IsSet("skip-repository") && ctx.Bool("skip-repository") { 263 - log.Info("Skip dumping local repositories") 267 + log.Info("Skipping local repositories") 264 268 } else { 265 269 log.Info("Dumping local repositories... %s", setting.RepoRootPath) 266 270 if err := addRecursiveExclude(w, "repos", setting.RepoRootPath, []string{absFileName}, verbose); err != nil { ··· 268 272 } 269 273 270 274 if ctx.IsSet("skip-lfs-data") && ctx.Bool("skip-lfs-data") { 271 - log.Info("Skip dumping LFS data") 275 + log.Info("Skipping LFS data") 272 276 } else if !setting.LFS.StartServer { 273 - log.Info("LFS isn't enabled. Skip dumping LFS data") 277 + log.Info("LFS not enabled - skipping") 274 278 } else if err := storage.LFS.IterateObjects("", func(objPath string, object storage.Object) error { 275 279 info, err := object.Stat() 276 280 if err != nil { ··· 295 299 defer func() { 296 300 _ = dbDump.Close() 297 301 if err := util.Remove(dbDump.Name()); err != nil { 298 - log.Warn("Unable to remove temporary file: %s: Error: %v", dbDump.Name(), err) 302 + log.Warn("Failed to remove temporary file: %s: Error: %v", dbDump.Name(), err) 299 303 } 300 304 }() 301 305 ··· 331 335 fatal("Failed to include custom: %v", err) 332 336 } 333 337 } else { 334 - log.Info("Custom dir %s is inside data dir %s, skipped", setting.CustomPath, setting.AppDataPath) 338 + log.Info("Custom dir %s is inside data dir %s, skipping", setting.CustomPath, setting.AppDataPath) 335 339 } 336 340 } else { 337 - log.Info("Custom dir %s doesn't exist, skipped", setting.CustomPath) 341 + log.Info("Custom dir %s does not exist, skipping", setting.CustomPath) 338 342 } 339 343 } 340 344 341 345 isExist, err := util.IsExist(setting.AppDataPath) 342 346 if err != nil { 343 - log.Error("Unable to check if %s exists. Error: %v", setting.AppDataPath, err) 347 + log.Error("Failed to check if %s exists: %v", setting.AppDataPath, err) 344 348 } 345 349 if isExist { 346 350 log.Info("Packing data directory...%s", setting.AppDataPath) ··· 355 359 } 356 360 357 361 if ctx.IsSet("skip-index") && ctx.Bool("skip-index") { 362 + log.Info("Skipping bleve index data") 358 363 excludes = append(excludes, setting.Indexer.RepoPath) 359 364 excludes = append(excludes, setting.Indexer.IssuePath) 360 365 } 361 366 367 + if ctx.IsSet("skip-repo-archives") && ctx.Bool("skip-repo-archives") { 368 + log.Info("Skipping repository archives data") 369 + excludes = append(excludes, setting.RepoArchive.Storage.Path) 370 + } 371 + 362 372 excludes = append(excludes, setting.RepoRootPath) 363 373 excludes = append(excludes, setting.LFS.Storage.Path) 364 374 excludes = append(excludes, setting.Attachment.Storage.Path) ··· 371 381 } 372 382 373 383 if ctx.IsSet("skip-attachment-data") && ctx.Bool("skip-attachment-data") { 374 - log.Info("Skip dumping attachment data") 384 + log.Info("Skipping attachment data") 375 385 } else if err := storage.Attachments.IterateObjects("", func(objPath string, object storage.Object) error { 376 386 info, err := object.Stat() 377 387 if err != nil { ··· 384 394 } 385 395 386 396 if ctx.IsSet("skip-package-data") && ctx.Bool("skip-package-data") { 387 - log.Info("Skip dumping package data") 397 + log.Info("Skipping package data") 388 398 } else if !setting.Packages.Enabled { 389 - log.Info("Packages isn't enabled. Skip dumping package data") 399 + log.Info("Package registry not enabled - skipping") 390 400 } else if err := storage.Packages.IterateObjects("", func(objPath string, object storage.Object) error { 391 401 info, err := object.Stat() 392 402 if err != nil { ··· 402 412 // ensuring that it's clear the dump is skipped whether the directory's initialized 403 413 // yet or not. 404 414 if ctx.IsSet("skip-log") && ctx.Bool("skip-log") { 405 - log.Info("Skip dumping log files") 415 + log.Info("Skipping log files") 406 416 } else { 407 417 isExist, err := util.IsExist(setting.Log.RootPath) 408 418 if err != nil { 409 - log.Error("Unable to check if %s exists. Error: %v", setting.Log.RootPath, err) 419 + log.Error("Failed to check if %s exists: %v", setting.Log.RootPath, err) 410 420 } 411 421 if isExist { 412 422 if err := addRecursiveExclude(w, "log", setting.Log.RootPath, []string{absFileName}, verbose); err != nil { ··· 456 466 currentInsidePath := path.Join(insidePath, file.Name()) 457 467 458 468 if util.SliceContainsString(excludeAbsPath, currentAbsPath) { 459 - log.Debug("Skipping %q because matched an excluded path.", currentAbsPath) 469 + log.Debug("Skipping %q (matched an excluded path)", currentAbsPath) 460 470 continue 461 471 } 462 472