From 7a7e426352d4483723ddb467bff21871e1d54ff9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 4 Jul 2013 02:36:02 -0400 Subject: [PATCH] moved AssociatedFile definition --- Annex/Wanted.hs | 1 - Assistant/Drop.hs | 2 +- Assistant/TransferrerPool.hs | 1 - Assistant/Types/TransferQueue.hs | 1 - Command/Get.hs | 1 - Command/Move.hs | 1 - Command/TransferKeys.hs | 1 - Logs/Transfer.hs | 1 - Logs/Unused.hs | 2 +- Seek.hs | 14 +++++++------- Types.hs | 1 + Types/Key.hs | 6 +++++- Types/Remote.hs | 3 --- 13 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Annex/Wanted.hs b/Annex/Wanted.hs index 2500f80d13..b90a1af317 100644 --- a/Annex/Wanted.hs +++ b/Annex/Wanted.hs @@ -10,7 +10,6 @@ module Annex.Wanted where import Common.Annex import Logs.PreferredContent import Annex.UUID -import Types.Remote import qualified Data.Set as S diff --git a/Assistant/Drop.hs b/Assistant/Drop.hs index 1fc2f75d92..d677a69c8b 100644 --- a/Assistant/Drop.hs +++ b/Assistant/Drop.hs @@ -11,7 +11,7 @@ import Assistant.Common import Assistant.DaemonStatus import Logs.Location import Logs.Trust -import Types.Remote (AssociatedFile, uuid) +import Types.Remote (uuid) import qualified Remote import qualified Command.Drop import Command diff --git a/Assistant/TransferrerPool.hs b/Assistant/TransferrerPool.hs index 68ec743f8d..d9104f74dd 100644 --- a/Assistant/TransferrerPool.hs +++ b/Assistant/TransferrerPool.hs @@ -16,7 +16,6 @@ import Control.Concurrent.STM import System.Process (create_group) import Control.Exception (throw) import Control.Concurrent -import Types.Remote (AssociatedFile) {- Runs an action with a Transferrer from the pool. -} withTransferrer :: FilePath -> TransferrerPool -> (Transferrer -> IO a) -> IO a diff --git a/Assistant/Types/TransferQueue.hs b/Assistant/Types/TransferQueue.hs index e4e305d5ac..e4bf2ae922 100644 --- a/Assistant/Types/TransferQueue.hs +++ b/Assistant/Types/TransferQueue.hs @@ -9,7 +9,6 @@ module Assistant.Types.TransferQueue where import Common.Annex import Logs.Transfer -import Types.Remote import Control.Concurrent.STM import Utility.TList diff --git a/Command/Get.hs b/Command/Get.hs index 0bbe4dc1a4..31a75c3e1b 100644 --- a/Command/Get.hs +++ b/Command/Get.hs @@ -16,7 +16,6 @@ import Logs.Transfer import Annex.Wanted import GitAnnex.Options import Types.Key -import Types.Remote def :: [Command] def = [withOptions getOptions $ command "get" paramPaths seek diff --git a/Command/Move.hs b/Command/Move.hs index 142a84d71d..357ccc21ea 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -19,7 +19,6 @@ import Logs.Presence import Logs.Transfer import GitAnnex.Options import Types.Key -import Types.Remote def :: [Command] def = [withOptions moveOptions $ command "move" paramPaths seek diff --git a/Command/TransferKeys.hs b/Command/TransferKeys.hs index 2f5ea1fe4a..8da29e211e 100644 --- a/Command/TransferKeys.hs +++ b/Command/TransferKeys.hs @@ -15,7 +15,6 @@ import Annex.Content import Logs.Location import Logs.Transfer import qualified Remote -import Types.Remote (AssociatedFile) import Types.Key import qualified Option diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs index 47c6e74953..ec3e9cb261 100644 --- a/Logs/Transfer.hs +++ b/Logs/Transfer.hs @@ -13,7 +13,6 @@ import Common.Annex import Annex.Perms import Annex.Exception import qualified Git -import Types.Remote import Types.Key import Utility.Metered import Utility.Percentage diff --git a/Logs/Unused.hs b/Logs/Unused.hs index 271211ed2d..4de5bc17a3 100644 --- a/Logs/Unused.hs +++ b/Logs/Unused.hs @@ -6,7 +6,7 @@ -} module Logs.Unused ( - UnusedMap(..), + UnusedMap, writeUnusedLog, readUnusedLog, unusedKeys, diff --git a/Seek.hs b/Seek.hs index b90a337e62..817687b453 100644 --- a/Seek.hs +++ b/Seek.hs @@ -134,15 +134,15 @@ withNothing _ _ = error "This command takes no parameters." withKeyOptions :: (Key -> CommandStart) -> CommandSeek -> CommandSeek withKeyOptions keyop fallbackop params = do bare <- fromRepo Git.repoIsLocalBare - all <- Annex.getFlag "all" <||> pure bare + allkeys <- Annex.getFlag "all" <||> pure bare unused <- Annex.getFlag "unused" auto <- Annex.getState Annex.auto - case (all , unused, auto ) of - (True , False , False) -> go loggedKeys - (False, True , False) -> go unusedKeys - (True , True , _ ) -> error "Cannot use --all with --unused." - (False, False , _ ) -> fallbackop params - (_ , _ , True ) + case (allkeys , unused, auto ) of + (True , False , False) -> go loggedKeys + (False , True , False) -> go unusedKeys + (True , True , _ ) -> error "Cannot use --all with --unused." + (False , False , _ ) -> fallbackop params + (_ , _ , True ) | bare -> error "Cannot use --auto in a bare repository." | otherwise -> error "Cannot use --auto with --all or --unused." where diff --git a/Types.hs b/Types.hs index ea0fa6b891..8768ed1fe6 100644 --- a/Types.hs +++ b/Types.hs @@ -9,6 +9,7 @@ module Types ( Annex, Backend, Key, + AssociatedFile, UUID(..), GitConfig(..), RemoteGitConfig(..), diff --git a/Types/Key.hs b/Types/Key.hs index 51449ca33e..910819a146 100644 --- a/Types/Key.hs +++ b/Types/Key.hs @@ -9,6 +9,7 @@ module Types.Key ( Key(..), + AssociatedFile, stubKey, key2file, file2key, @@ -21,7 +22,7 @@ import System.Posix.Types import Common import Utility.QuickCheck -{- A Key has a unique name, is associated with a key/value backend, +{- A Key has a unique name, which is derived from a particular backend, - and may contain other optional metadata. -} data Key = Key { keyName :: String, @@ -30,6 +31,9 @@ data Key = Key { keyMtime :: Maybe EpochTime } deriving (Eq, Ord, Read, Show) +{- A filename may be associated with a Key. -} +type AssociatedFile = Maybe FilePath + stubKey :: Key stubKey = Key { keyName = "", diff --git a/Types/Remote.hs b/Types/Remote.hs index 98cac37e42..8492be06d3 100644 --- a/Types/Remote.hs +++ b/Types/Remote.hs @@ -37,9 +37,6 @@ data RemoteTypeA a = RemoteType { instance Eq (RemoteTypeA a) where x == y = typename x == typename y -{- A filename associated with a Key, for display to user. -} -type AssociatedFile = Maybe FilePath - {- An individual remote. -} data RemoteA a = Remote { -- each Remote has a unique uuid