plumb MeterUpdate into getKey
No behavior changes, but this shows everywhere that a progress meter could be displayed when hashing a file to add to the annex. Many of the places don't make sense to display a progress meter though, eg when importing the copy of the file probably swamps the hashing of the file.
This commit is contained in:
parent
191bdaafc5
commit
8355dba5cc
18 changed files with 60 additions and 44 deletions
|
@ -22,6 +22,7 @@ import Annex.CheckAttr
|
|||
import Types.Key
|
||||
import Types.KeySource
|
||||
import qualified Types.Backend as B
|
||||
import Utility.Metered
|
||||
|
||||
-- When adding a new backend, import it here and add it to the list.
|
||||
import qualified Backend.Hash
|
||||
|
@ -50,10 +51,10 @@ defaultBackend = maybe cache return =<< Annex.getState Annex.backend
|
|||
lookupname = lookupBackendVariety . parseKeyVariety . encodeBS
|
||||
|
||||
{- Generates a key for a file. -}
|
||||
genKey :: KeySource -> Maybe Backend -> Annex (Maybe (Key, Backend))
|
||||
genKey source preferredbackend = do
|
||||
genKey :: KeySource -> MeterUpdate -> Maybe Backend -> Annex (Maybe (Key, Backend))
|
||||
genKey source meterupdate preferredbackend = do
|
||||
b <- maybe defaultBackend return preferredbackend
|
||||
B.getKey b source >>= return . \case
|
||||
B.getKey b source meterupdate >>= return . \case
|
||||
Nothing -> Nothing
|
||||
Just k -> Just (makesane k, b)
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue