added 'rewrite --prefixed' flag to only rewrite prefixed content IDs (by default only rewrites non-prefixed IDs)

This commit is contained in:
Jarek Kowalski
2019-07-18 18:43:54 -10:00
parent 6ef696d97a
commit 829faf8e1a
3 changed files with 6 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
var (
contentRewriteCommand = contentCommands.Command("rewrite", "Rewrite content using most recent format")
contentRewriteIDs = contentRewriteCommand.Arg("contentID", "Identifiers of contents to rewrite").Strings()
contentRewritePrefixed = contentRewriteCommand.Flag("prefixed", "Rewrite contents with a non-empty prefix").Bool()
contentRewriteParallelism = contentRewriteCommand.Flag("parallelism", "Number of parallel workers").Default("16").Int()
contentRewriteShortPacks = contentRewriteCommand.Flag("short", "Rewrite contents from short packs").Bool()
@@ -160,7 +161,9 @@ func findContentInShortPacks(rep *repo.Repository, ch chan contentInfoOrError, t
} else {
for _, b := range infos {
if shortPackBlocks[b.PackBlobID] && strings.HasPrefix(string(b.PackBlobID), *contentRewritePackPrefix) {
ch <- contentInfoOrError{Info: b}
if b.ID.HasPrefix() == *contentRewritePrefixed {
ch <- contentInfoOrError{Info: b}
}
}
}
}

View File

@@ -11,7 +11,7 @@
)
var (
repairCommand = repositoryCommands.Command("repair", "Repairs respository.")
repairCommand = repositoryCommands.Command("repair", "Repairs repository.")
repairCommandRecoverFormatBlob = repairCommand.Flag("recover-format", "Recover format blob from a copy").Default("auto").Enum("auto", "yes", "no")
repairCommandRecoverFormatBlobPrefixes = repairCommand.Flag("recover-format-block-prefixes", "Prefixes of file names").Strings()

View File

@@ -55,7 +55,7 @@ func runMigrateCommand(ctx context.Context, destRepo *repo.Repository) error {
if !canceled {
canceled = true
for s, u := range activeUploaders {
log.Warningf("cancelling active uploader for %v", s)
log.Warningf("canceling active uploader for %v", s)
u.Cancel()
}
}