add remote start and stop hooks

Locking is used, so that, if there are multiple git-annex processes
using a remote concurrently, the stop hook is only run by the last
process that uses it.
This commit is contained in:
Joey Hess 2012-03-04 16:00:24 -04:00
parent fba66c55ed
commit 52e88f3ebf
5 changed files with 118 additions and 1 deletions

View file

@ -15,6 +15,7 @@ import Logs.Remote
import Types.Remote
import Annex.UUID
import Config
import Remote.Helper.Hooks
import qualified Remote.Git
import qualified Remote.S3
@ -51,7 +52,7 @@ remoteList = do
process m t = enumerate t >>= mapM (gen m t)
gen m t r = do
u <- getRepoUUID r
generate t r u (M.lookup u m)
addHooks =<< generate t r u (M.lookup u m)
{- All remotes that are not ignored. -}
enabledRemoteList :: Annex [Remote]