diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-08-13 17:26:09 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-08-13 17:27:50 -0400 |
commit | c4e65d4c3e8a226fb3ec933bdea3daea903b3e84 (patch) | |
tree | 3fa47712d7cd352bd5221a5c1d774632c30c135f /Remote/External.hs | |
parent | 411cf4993f47562524b476ab7f2b9721775eabdf (diff) |
Added WHEREIS to external special remote protocol.
Diffstat (limited to 'Remote/External.hs')
-rw-r--r-- | Remote/External.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Remote/External.hs b/Remote/External.hs index 6c36d879a..cd062e0c2 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -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 |