rest of the deserializeKey renameing
This commit is contained in:
parent
1791447cc8
commit
303e828b7c
15 changed files with 19 additions and 19 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue