reorg
This commit is contained in:
parent
bb7b026b18
commit
126d188812
1 changed files with 30 additions and 30 deletions
|
@ -579,36 +579,6 @@ getEnabledSpecialRemoteByName remotename =
|
|||
maybe (return (Just rmt)) giveup
|
||||
(checkSpecialRemoteProblems rmt)
|
||||
|
||||
formatManifest :: Manifest -> B.ByteString
|
||||
formatManifest manifest =
|
||||
B8.unlines $
|
||||
map serializeKey' (inManifest manifest)
|
||||
<>
|
||||
map (\k -> "-" <> serializeKey' k)
|
||||
(S.toList (outManifest manifest))
|
||||
|
||||
parseManifest :: B.ByteString -> Either String Manifest
|
||||
parseManifest b =
|
||||
let (outks, inks) = partitionEithers $ map parseline $ B8.lines b
|
||||
in case (checkvalid [] inks, checkvalid [] outks) of
|
||||
(Right inks', Right outks') ->
|
||||
Right $ mkManifest inks' (S.fromList outks')
|
||||
(Left err, _) -> Left err
|
||||
(_, Left err) -> Left err
|
||||
where
|
||||
parseline l
|
||||
| "-" `B.isPrefixOf` l =
|
||||
Left $ deserializeKey' $ B.drop 1 l
|
||||
| otherwise =
|
||||
Right $ deserializeKey' l
|
||||
|
||||
checkvalid c [] = Right (reverse c)
|
||||
checkvalid c (Just k:ks) = case fromKey keyVariety k of
|
||||
GitBundleKey -> checkvalid (k:c) ks
|
||||
_ -> Left $ "Wrong type of key in manifest " ++ serializeKey k
|
||||
checkvalid _ (Nothing:_) =
|
||||
Left "Error parsing manifest"
|
||||
|
||||
checkSpecialRemoteProblems :: Remote -> Maybe String
|
||||
checkSpecialRemoteProblems rmt
|
||||
-- Avoid using special remotes that are thirdparty populated,
|
||||
|
@ -738,6 +708,36 @@ uploadManifest rmt manifest = do
|
|||
unlinkAnnex mk
|
||||
return ok
|
||||
|
||||
formatManifest :: Manifest -> B.ByteString
|
||||
formatManifest manifest =
|
||||
B8.unlines $
|
||||
map serializeKey' (inManifest manifest)
|
||||
<>
|
||||
map (\k -> "-" <> serializeKey' k)
|
||||
(S.toList (outManifest manifest))
|
||||
|
||||
parseManifest :: B.ByteString -> Either String Manifest
|
||||
parseManifest b =
|
||||
let (outks, inks) = partitionEithers $ map parseline $ B8.lines b
|
||||
in case (checkvalid [] inks, checkvalid [] outks) of
|
||||
(Right inks', Right outks') ->
|
||||
Right $ mkManifest inks' (S.fromList outks')
|
||||
(Left err, _) -> Left err
|
||||
(_, Left err) -> Left err
|
||||
where
|
||||
parseline l
|
||||
| "-" `B.isPrefixOf` l =
|
||||
Left $ deserializeKey' $ B.drop 1 l
|
||||
| otherwise =
|
||||
Right $ deserializeKey' l
|
||||
|
||||
checkvalid c [] = Right (reverse c)
|
||||
checkvalid c (Just k:ks) = case fromKey keyVariety k of
|
||||
GitBundleKey -> checkvalid (k:c) ks
|
||||
_ -> Left $ "Wrong type of key in manifest " ++ serializeKey k
|
||||
checkvalid _ (Nothing:_) =
|
||||
Left "Error parsing manifest"
|
||||
|
||||
{- A manifest file is cached here before it or the bundles listed in it
|
||||
- is uploaded to the special remote.
|
||||
-
|
||||
|
|
Loading…
Reference in a new issue