From a5cb01cd4f6e90786ef738e7d666ff363e5b6828 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Aug 2015 11:21:38 -0400 Subject: export some always failing methods for readonly remotes --- Remote/Helper/ReadOnly.hs | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'Remote') diff --git a/Remote/Helper/ReadOnly.hs b/Remote/Helper/ReadOnly.hs index 2e327a040..c0330e453 100644 --- a/Remote/Helper/ReadOnly.hs +++ b/Remote/Helper/ReadOnly.hs @@ -1,14 +1,21 @@ {- Adds readonly support to remotes. - - - Copyright 2013 Joey Hess + - Copyright 2013, 2015 Joey Hess - - Licensed under the GNU GPL version 3 or higher. -} -module Remote.Helper.ReadOnly (adjustReadOnly) where +module Remote.Helper.ReadOnly + ( adjustReadOnly + , readonlyStoreKey + , readonlyStorer + , readonlyRemoveKey + ) where import Common.Annex import Types.Remote +import Types.StoreRetrieve +import Utility.Metered {- Adds support for read-only remotes, by replacing the - methods that write to a remote with dummies that fail. @@ -18,12 +25,22 @@ import Types.Remote adjustReadOnly :: Remote -> Remote adjustReadOnly r | remoteAnnexReadOnly (gitconfig r) = r - { storeKey = \_ _ _ -> failbool - , removeKey = \_ -> failbool + { storeKey = readonlyStoreKey + , removeKey = readonlyRemoveKey , repairRepo = Nothing } | otherwise = r - where - failbool = do - warning "this remote is readonly" - return False + +readonlyStoreKey :: Key -> AssociatedFile -> MeterUpdate -> Annex Bool +readonlyStoreKey _ _ _ = readonlyFail + +readonlyRemoveKey :: Key -> Annex Bool +readonlyRemoveKey _ = readonlyFail + +readonlyStorer :: Storer +readonlyStorer _ _ _ = readonlyFail + +readonlyFail :: Annex Bool +readonlyFail = do + warning "this remote is readonly" + return False -- cgit v1.2.3