diff options
author | Joey Hess <joey@kitenet.net> | 2014-08-03 19:48:50 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-08-03 19:48:50 -0400 |
commit | de856bc585ee19800a98a062e47daad01a8d94e1 (patch) | |
tree | b8578d196c99b336160821ac3099e44b2ec18454 /Command | |
parent | 85d6a14e09034c30b96a719ff5365736ba71d238 (diff) | |
parent | 3b80e1385001771ee1ec1121967e0d832191d8f0 (diff) |
Merge branch 'master' into newchunks
Diffstat (limited to 'Command')
-rw-r--r-- | Command/TestRemote.hs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Command/TestRemote.hs b/Command/TestRemote.hs index 3f75214a5..789eb75b1 100644 --- a/Command/TestRemote.hs +++ b/Command/TestRemote.hs @@ -59,8 +59,9 @@ start basesz ws = do showStart "testremote" name r <- either error id <$> Remote.byName' name showSideAction "generating test keys" - ks <- mapM randKey (keySizes basesz) - rs <- catMaybes <$> mapM (adjustChunkSize r) (chunkSizes basesz) + fast <- Annex.getState Annex.fast + ks <- mapM randKey (keySizes basesz fast) + rs <- catMaybes <$> mapM (adjustChunkSize r) (chunkSizes basesz fast) rs' <- concat <$> mapM encryptionVariants rs next $ perform rs' ks @@ -161,22 +162,29 @@ cleanup rs ks ok = do forM_ ks removeAnnex return ok -chunkSizes :: Int -> [Int] -chunkSizes base = +chunkSizes :: Int -> Bool -> [Int] +chunkSizes base False = [ 0 -- no chunking , base `div` 100 , base `div` 1000 , base ] +chunkSizes base True = + [ 0 + ] -keySizes :: Int -> [Int] -keySizes base = filter (>= 0) +keySizes :: Int -> Bool -> [Int] +keySizes base fast = filter want [ 0 -- empty key is a special case when chunking , base , base + 1 , base - 1 , base * 2 ] + where + want sz + | fast = sz <= base && sz > 0 + | otherwise = sz > 0 randKey :: Int -> Annex Key randKey sz = withTmpFile "randkey" $ \f h -> do |