Added WHEREIS to external special remote protocol.

This commit is contained in:
Joey Hess 2015-08-13 17:26:09 -04:00
parent c6bea20f3d
commit 6bc46e384e
5 changed files with 56 additions and 5 deletions

View file

@ -60,7 +60,7 @@ gen r u c gc = do
, removeKey = removeKeyDummy
, checkPresent = checkPresentDummy
, checkPresentCheap = False
, whereisKey = Nothing
, whereisKey = Just $ whereis external
, remoteFsck = Nothing
, repairRepo = Nothing
, config = c
@ -144,6 +144,13 @@ checkKey external k = either error id <$> go
| k' == k -> Just $ return $ Left errmsg
_ -> Nothing
whereis :: External -> Key -> Annex [String]
whereis external k = handleRequest external (WHEREIS k) Nothing $ \resp -> case resp of
WHEREIS_SUCCESS s -> Just $ return [s]
WHEREIS_FAILURE -> Just $ return []
UNSUPPORTED_REQUEST -> Just $ return []
_ -> Nothing
safely :: Annex Bool -> Annex Bool
safely a = go =<< tryNonAsync a
where