rest of the deserializeKey renameing
This commit is contained in:
parent
1791447cc8
commit
303e828b7c
15 changed files with 19 additions and 19 deletions
|
@ -210,7 +210,7 @@ parseAllOption = flag' WantAllKeys
|
|||
)
|
||||
|
||||
parseKey :: Monad m => String -> m Key
|
||||
parseKey = maybe (fail "invalid key") return . file2key
|
||||
parseKey = maybe (fail "invalid key") return . deserializeKey
|
||||
|
||||
-- Options to match properties of annexed files.
|
||||
annexedMatchingOptions :: [GlobalOption]
|
||||
|
|
|
@ -158,7 +158,7 @@ withFilesMaybeModified a params = seekActions $
|
|||
withKeys :: (Key -> CommandSeek) -> CmdParams -> CommandSeek
|
||||
withKeys a l = seekActions $ return $ map (a . parse) l
|
||||
where
|
||||
parse p = fromMaybe (giveup "bad key") $ file2key p
|
||||
parse p = fromMaybe (giveup "bad key") $ deserializeKey p
|
||||
|
||||
withNothing :: CommandSeek -> CmdParams -> CommandSeek
|
||||
withNothing a [] = a
|
||||
|
|
|
@ -69,7 +69,7 @@ batchResult Present = liftIO $ putStrLn "1"
|
|||
batchResult _ = liftIO $ putStrLn "0"
|
||||
|
||||
toKey :: String -> Key
|
||||
toKey = fromMaybe (giveup "Bad key") . file2key
|
||||
toKey = fromMaybe (giveup "Bad key") . deserializeKey
|
||||
|
||||
toRemote :: String -> Annex Remote
|
||||
toRemote rn = maybe (giveup "Unknown remote") return
|
||||
|
|
|
@ -19,7 +19,7 @@ cmd = noCommit $ noMessages $
|
|||
|
||||
run :: () -> String -> Annex Bool
|
||||
run _ p = do
|
||||
let k = fromMaybe (giveup "bad key") $ file2key p
|
||||
let k = fromMaybe (giveup "bad key") $ deserializeKey p
|
||||
maybe (return False) (\f -> liftIO (putStrLn f) >> return True)
|
||||
=<< inAnnex' (pure True) Nothing check k
|
||||
where
|
||||
|
|
|
@ -38,7 +38,7 @@ seek o = do
|
|||
Batch fmt -> batchInput fmt parsekey $ batchCommandAction . start
|
||||
NoBatch -> noop
|
||||
where
|
||||
parsekey = maybe (Left "bad key") Right . file2key
|
||||
parsekey = maybe (Left "bad key") Right . deserializeKey
|
||||
|
||||
start :: Key -> CommandStart
|
||||
start key = do
|
||||
|
|
|
@ -79,7 +79,7 @@ mkKey :: String -> Key
|
|||
mkKey s = case parseURI s of
|
||||
Just u | not (isKeyPrefix (uriScheme u)) ->
|
||||
Backend.URL.fromUrl s Nothing
|
||||
_ -> case file2key s of
|
||||
_ -> case deserializeKey s of
|
||||
Just k -> k
|
||||
Nothing -> giveup $ "bad key/url " ++ s
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ start [ks] = do
|
|||
then exitSuccess
|
||||
else exitFailure
|
||||
where
|
||||
k = fromMaybe (giveup "bad key") (file2key ks)
|
||||
k = fromMaybe (giveup "bad key") (deserializeKey ks)
|
||||
locksuccess = liftIO $ do
|
||||
putStrLn contentLockedMarker
|
||||
hFlush stdout
|
||||
|
|
|
@ -208,7 +208,7 @@ receive ups = do
|
|||
|
||||
storeReceived :: FilePath -> Annex ()
|
||||
storeReceived f = do
|
||||
case file2key (takeFileName f) of
|
||||
case deserializeKey (takeFileName f) of
|
||||
Nothing -> do
|
||||
warning $ "Received a file " ++ f ++ " that is not a git-annex key. Deleting this file."
|
||||
liftIO $ nukeFile f
|
||||
|
|
|
@ -43,7 +43,7 @@ batchParser :: String -> Either String (FilePath, Key)
|
|||
batchParser s = case separate (== ' ') (reverse s) of
|
||||
(rk, rf)
|
||||
| null rk || null rf -> Left "Expected: \"file key\""
|
||||
| otherwise -> case file2key (reverse rk) of
|
||||
| otherwise -> case deserializeKey (reverse rk) of
|
||||
Nothing -> Left "bad key"
|
||||
Just k -> Right (reverse rf, k)
|
||||
|
||||
|
@ -53,7 +53,7 @@ seek o = case batchOption o of
|
|||
NoBatch -> withPairs (commandAction . start . parsekey) (reKeyThese o)
|
||||
where
|
||||
parsekey (file, skey) =
|
||||
(file, fromMaybe (giveup "bad key") (file2key skey))
|
||||
(file, fromMaybe (giveup "bad key") (deserializeKey skey))
|
||||
|
||||
start :: (FilePath, Key) -> CommandStart
|
||||
start (file, newkey) = ifAnnexed file go stop
|
||||
|
|
|
@ -27,5 +27,5 @@ start (ks:us:[]) = do
|
|||
then liftIO exitSuccess
|
||||
else liftIO exitFailure
|
||||
where
|
||||
k = fromMaybe (giveup "bad key") (file2key ks)
|
||||
k = fromMaybe (giveup "bad key") (deserializeKey ks)
|
||||
start _ = giveup "Wrong number of parameters"
|
||||
|
|
|
@ -26,7 +26,7 @@ start (keyname:file:[]) = do
|
|||
start _ = giveup "specify a key and a content file"
|
||||
|
||||
mkKey :: String -> Key
|
||||
mkKey = fromMaybe (giveup "bad key") . file2key
|
||||
mkKey = fromMaybe (giveup "bad key") . deserializeKey
|
||||
|
||||
perform :: FilePath -> Key -> CommandPerform
|
||||
perform file key = do
|
||||
|
|
|
@ -40,7 +40,7 @@ data KeyStatus = KeyStatus Key UUID LogStatus
|
|||
|
||||
parseKeyStatus :: [String] -> Either String KeyStatus
|
||||
parseKeyStatus (ks:us:vs:[]) = do
|
||||
k <- maybe (Left "bad key") Right (file2key ks)
|
||||
k <- maybe (Left "bad key") Right (deserializeKey ks)
|
||||
let u = toUUID us
|
||||
s <- maybe (Left "bad value") Right (parseStatus vs)
|
||||
return $ KeyStatus k u s
|
||||
|
|
|
@ -38,7 +38,7 @@ seek = withWords (commandAction . start)
|
|||
-}
|
||||
start :: [String] -> CommandStart
|
||||
start (k:[]) = do
|
||||
case file2key k of
|
||||
case deserializeKey k of
|
||||
Nothing -> error "bad key"
|
||||
(Just key) -> whenM (inAnnex key) $ do
|
||||
afile <- AssociatedFile <$> Fields.getField Fields.associatedFile
|
||||
|
|
8
Key.hs
8
Key.hs
|
@ -14,8 +14,8 @@ module Key (
|
|||
buildKey,
|
||||
keyParser,
|
||||
serializeKey,
|
||||
serializeKey,
|
||||
deserializeKey',
|
||||
serializeKey',
|
||||
deserializeKey,
|
||||
deserializeKey',
|
||||
nonChunkKey,
|
||||
chunkKeyOffset,
|
||||
|
@ -179,8 +179,8 @@ instance Arbitrary Key where
|
|||
<*> ((succ . abs <$>) <$> arbitrary) -- chunknum cannot be 0 or negative
|
||||
|
||||
instance Hashable Key where
|
||||
hashIO32 = hashIO32 . deserializeKey'
|
||||
hashIO64 = hashIO64 . deserializeKey'
|
||||
hashIO32 = hashIO32 . serializeKey'
|
||||
hashIO64 = hashIO64 . serializeKey'
|
||||
|
||||
instance ToJSON' Key where
|
||||
toJSON' = toJSON' . serializeKey
|
||||
|
|
|
@ -144,7 +144,7 @@ oldlog2key l
|
|||
-- as the v2 key that it is.
|
||||
readKey1 :: String -> Key
|
||||
readKey1 v
|
||||
| mixup = fromJust $ file2key $ intercalate ":" $ Prelude.tail bits
|
||||
| mixup = fromJust $ deserializeKey $ intercalate ":" $ Prelude.tail bits
|
||||
| otherwise = stubKey
|
||||
{ keyName = encodeBS n
|
||||
, keyVariety = parseKeyVariety (encodeBS b)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue