From c1c5ff5626edbd4474b327dc8b8e66bd218b3e5e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 13 Mar 2014 19:06:26 -0400 Subject: clean up cleanup action enumeration --- Remote/External.hs | 3 ++- Remote/Git.hs | 3 ++- Remote/Helper/Hooks.hs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Remote') diff --git a/Remote/External.hs b/Remote/External.hs index 50a0767ea..9be9175c7 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -11,6 +11,7 @@ import Remote.External.Types import qualified Annex import Common.Annex import Types.Remote +import Types.CleanupActions import qualified Git import Config import Remote.Helper.Special @@ -43,7 +44,7 @@ remote = RemoteType { gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex (Maybe Remote) gen r u c gc = do external <- newExternal externaltype u c - Annex.addCleanup (fromUUID u) $ stopExternal external + Annex.addCleanup (RemoteCleanup u) $ stopExternal external cst <- getCost external r gc avail <- getAvailability external r gc return $ Just $ encryptableRemote c diff --git a/Remote/Git.hs b/Remote/Git.hs index 14157f498..995d66779 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -36,6 +36,7 @@ import Config import Config.Cost import Annex.Init import Types.Key +import Types.CleanupActions import qualified CmdLine.GitAnnexShell.Fields as Fields import Logs.Location import Utility.Metered @@ -510,7 +511,7 @@ rsyncOrCopyFile rsyncparams src dest p = commitOnCleanup :: Remote -> Annex a -> Annex a commitOnCleanup r a = go `after` a where - go = Annex.addCleanup (Git.repoLocation $ repo r) cleanup + go = Annex.addCleanup (RemoteCleanup $ uuid r) cleanup cleanup | not $ Git.repoIsUrl (repo r) = onLocal r $ doQuietSideAction $ diff --git a/Remote/Helper/Hooks.hs b/Remote/Helper/Hooks.hs index f876649f0..b7deae577 100644 --- a/Remote/Helper/Hooks.hs +++ b/Remote/Helper/Hooks.hs @@ -13,6 +13,7 @@ import qualified Data.Map as M import Common.Annex import Types.Remote +import Types.CleanupActions import qualified Annex import Annex.LockPool #ifndef mingw32_HOST_OS @@ -74,7 +75,7 @@ runHooks r starthook stophook a = do -- So, requiring idempotency is the right approach. run starthook - Annex.addCleanup (remoteid ++ "-stop-command") $ runstop lck + Annex.addCleanup (StopHook $ uuid r) $ runstop lck runstop lck = do -- Drop any shared lock we have, and take an -- exclusive lock, without blocking. If the lock -- cgit v1.2.3