From 703c437bd9c6cb9e4675b65ac2b107f76b135d71 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 1 Jun 2011 21:56:04 -0400 Subject: [PATCH] rename modules for data types into Types/ directory --- Annex.hs | 8 ++++---- Backend.hs | 4 ++-- Backend/File.hs | 4 ++-- Backend/SHA.hs | 4 ++-- Backend/URL.hs | 4 ++-- Backend/WORM.hs | 4 ++-- Command.hs | 2 +- Command/DropUnused.hs | 2 +- Command/FromKey.hs | 2 +- Command/InitRemote.hs | 16 ++++++++-------- Command/Status.hs | 10 +++++----- Content.hs | 2 +- Crypto.hs | 6 +++--- Locations.hs | 2 +- Remote.hs | 2 +- Remote/Bup.hs | 2 +- Remote/Directory.hs | 2 +- Remote/Encryptable.hs | 2 +- Remote/Git.hs | 2 +- Remote/Hook.hs | 2 +- Remote/Rsync.hs | 2 +- Remote/S3real.hs | 4 ++-- Remote/Special.hs | 2 +- Types.hs | 4 ++-- BackendClass.hs => Types/Backend.hs | 4 ++-- CryptoTypes.hs => Types/Crypto.hs | 2 +- Key.hs => Types/Key.hs | 4 +++- RemoteClass.hs => Types/Remote.hs | 6 +++--- UUIDType.hs => Types/UUID.hs | 2 +- UUID.hs | 2 +- Upgrade/V1.hs | 2 +- test.hs | 4 ++-- 32 files changed, 61 insertions(+), 59 deletions(-) rename BackendClass.hs => Types/Backend.hs (96%) rename CryptoTypes.hs => Types/Crypto.hs (94%) rename Key.hs => Types/Key.hs (95%) rename RemoteClass.hs => Types/Remote.hs (96%) rename UUIDType.hs => Types/UUID.hs (90%) diff --git a/Annex.hs b/Annex.hs index 92a4911ea1..06d642b742 100644 --- a/Annex.hs +++ b/Annex.hs @@ -21,11 +21,11 @@ import Control.Monad.State import qualified GitRepo as Git import GitQueue -import BackendClass -import RemoteClass -import CryptoTypes +import Types.Backend +import Types.Remote +import Types.Crypto import TrustLevel -import UUIDType +import Types.UUID -- git-annex's monad type Annex = StateT AnnexState IO diff --git a/Backend.hs b/Backend.hs index 645bfdfc3f..78a53d02c7 100644 --- a/Backend.hs +++ b/Backend.hs @@ -42,8 +42,8 @@ import Locations import qualified GitRepo as Git import qualified Annex import Types -import Key -import qualified BackendClass as B +import Types.Key +import qualified Types.Backend as B import Messages import Content import DataUnits diff --git a/Backend/File.hs b/Backend/File.hs index 543f02af76..bf21224a92 100644 --- a/Backend/File.hs +++ b/Backend/File.hs @@ -18,7 +18,7 @@ import Control.Monad.State (liftIO) import Data.List import Data.String.Utils -import BackendClass +import Types.Backend import LocationLog import qualified Remote import qualified GitRepo as Git @@ -28,7 +28,7 @@ import Types import UUID import Messages import Trust -import Key +import Types.Key backend :: Backend Annex backend = Backend { diff --git a/Backend/SHA.hs b/Backend/SHA.hs index 6d721038c3..94ebe093ed 100644 --- a/Backend/SHA.hs +++ b/Backend/SHA.hs @@ -17,15 +17,15 @@ import System.Posix.Files import System.FilePath import qualified Backend.File -import BackendClass import Messages import qualified Annex import Locations import Content import Types +import Types.Backend +import Types.Key import Utility import qualified SysConfig -import Key type SHASize = Int diff --git a/Backend/URL.hs b/Backend/URL.hs index 3068c30270..e41004dd46 100644 --- a/Backend/URL.hs +++ b/Backend/URL.hs @@ -10,10 +10,10 @@ module Backend.URL (backends) where import Control.Monad.State (liftIO) import Types -import BackendClass +import Types.Backend import Utility import Messages -import Key +import Types.Key backends :: [Backend Annex] backends = [backend] diff --git a/Backend/WORM.hs b/Backend/WORM.hs index b33c607632..dc2e48adce 100644 --- a/Backend/WORM.hs +++ b/Backend/WORM.hs @@ -12,9 +12,9 @@ import System.FilePath import System.Posix.Files import qualified Backend.File -import BackendClass +import Types.Backend import Types -import Key +import Types.Key backends :: [Backend Annex] backends = [backend] diff --git a/Command.hs b/Command.hs index 0da847d24d..228c1f40e9 100644 --- a/Command.hs +++ b/Command.hs @@ -24,7 +24,7 @@ import qualified Annex import qualified GitRepo as Git import Locations import Utility -import Key +import Types.Key {- A command runs in four stages. - diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs index 1bb3b7f970..0f99814471 100644 --- a/Command/DropUnused.hs +++ b/Command/DropUnused.hs @@ -22,7 +22,7 @@ import qualified Command.Move import qualified Remote import qualified GitRepo as Git import Backend -import Key +import Types.Key import Utility type UnusedMap = M.Map String Key diff --git a/Command/FromKey.hs b/Command/FromKey.hs index ca61094eb4..34816d6574 100644 --- a/Command/FromKey.hs +++ b/Command/FromKey.hs @@ -18,7 +18,7 @@ import Utility import qualified Backend import Content import Messages -import Key +import Types.Key command :: [Command] command = [repoCommand "fromkey" paramPath seek diff --git a/Command/InitRemote.hs b/Command/InitRemote.hs index 460f14de2c..41d3c37c71 100644 --- a/Command/InitRemote.hs +++ b/Command/InitRemote.hs @@ -16,7 +16,7 @@ import Data.String.Utils import Command import qualified Annex import qualified Remote -import qualified RemoteClass +import qualified Types.Remote as R import qualified GitRepo as Git import Utility import Types @@ -54,12 +54,12 @@ start ws = notBareRepo $ do else err $ "Either a new name, or one of these existing special remotes: " ++ join " " names -perform :: RemoteClass.RemoteType Annex -> UUID -> RemoteClass.RemoteConfig -> CommandPerform +perform :: R.RemoteType Annex -> UUID -> R.RemoteConfig -> CommandPerform perform t u c = do - c' <- RemoteClass.setup t u c + c' <- R.setup t u c next $ cleanup u c' -cleanup :: UUID -> RemoteClass.RemoteConfig -> CommandCleanup +cleanup :: UUID -> R.RemoteConfig -> CommandCleanup cleanup u c = do Remote.configSet u c g <- Annex.gitRepo @@ -73,7 +73,7 @@ cleanup u c = do return True {- Look up existing remote's UUID and config by name, or generate a new one -} -findByName :: String -> Annex (UUID, RemoteClass.RemoteConfig) +findByName :: String -> Annex (UUID, R.RemoteConfig) findByName name = do m <- Remote.readRemoteLog maybe generate return $ findByName' name m @@ -82,7 +82,7 @@ findByName name = do uuid <- liftIO $ genUUID return (uuid, M.insert nameKey name M.empty) -findByName' :: String -> M.Map UUID RemoteClass.RemoteConfig -> Maybe (UUID, RemoteClass.RemoteConfig) +findByName' :: String -> M.Map UUID R.RemoteConfig -> Maybe (UUID, R.RemoteConfig) findByName' n m = if null matches then Nothing else Just $ head matches where matches = filter (matching . snd) $ M.toList m @@ -98,14 +98,14 @@ remoteNames = do return $ catMaybes $ map ((M.lookup nameKey) . snd) $ M.toList m {- find the specified remote type -} -findType :: RemoteClass.RemoteConfig -> Annex (RemoteClass.RemoteType Annex) +findType :: R.RemoteConfig -> Annex (R.RemoteType Annex) findType config = maybe unspecified specified $ M.lookup typeKey config where unspecified = error "Specify the type of remote with type=" specified s = case filter (findtype s) Remote.remoteTypes of [] -> error $ "Unknown remote type " ++ s (t:_) -> return t - findtype s i = RemoteClass.typename i == s + findtype s i = R.typename i == s {- The name of a configured remote is stored in its config using this key. -} nameKey :: String diff --git a/Command/Status.hs b/Command/Status.hs index dd518416cf..1a7f694ba8 100644 --- a/Command/Status.hs +++ b/Command/Status.hs @@ -14,8 +14,8 @@ import Data.List import qualified Data.Map as M import qualified Annex -import qualified BackendClass -import qualified RemoteClass +import qualified Types.Backend as B +import qualified Types.Remote as R import qualified Remote import qualified Command.Unused import qualified GitRepo as Git @@ -23,7 +23,7 @@ import Command import Types import DataUnits import Content -import Key +import Types.Key import Locations -- a named computation that produces a statistic @@ -97,11 +97,11 @@ showStat s = calc =<< s supported_backends :: Stat supported_backends = stat "supported backends" $ lift (Annex.getState Annex.supportedBackends) >>= - return . unwords . (map BackendClass.name) + return . unwords . (map B.name) supported_remote_types :: Stat supported_remote_types = stat "supported remote types" $ - return $ unwords $ map RemoteClass.typename Remote.remoteTypes + return $ unwords $ map R.typename Remote.remoteTypes local_annex_size :: Stat local_annex_size = stat "local annex size" $ diff --git a/Content.hs b/Content.hs index ec7a3776bf..57977ce344 100644 --- a/Content.hs +++ b/Content.hs @@ -41,7 +41,7 @@ import qualified Annex import qualified AnnexQueue import Utility import StatFS -import Key +import Types.Key import DataUnits import Config diff --git a/Crypto.hs b/Crypto.hs index 42f1389507..e84e397f2e 100644 --- a/Crypto.hs +++ b/Crypto.hs @@ -43,11 +43,11 @@ import System.Exit import System.Environment import Types -import Key -import RemoteClass +import Types.Key +import Types.Remote import Utility import Base64 -import CryptoTypes +import Types.Crypto {- The first half of a Cipher is used for HMAC; the remainder - is used as the GPG symmetric encryption passphrase. diff --git a/Locations.hs b/Locations.hs index 38a320a2b2..da781ac83a 100644 --- a/Locations.hs +++ b/Locations.hs @@ -36,7 +36,7 @@ import Word import Data.Hash.MD5 import Types -import Key +import Types.Key import qualified GitRepo as Git {- Conventions: diff --git a/Remote.hs b/Remote.hs index 9685b4612f..e7ef5f1952 100644 --- a/Remote.hs +++ b/Remote.hs @@ -39,8 +39,8 @@ import qualified Data.Map as M import Data.Maybe import Data.Char -import RemoteClass import Types +import Types.Remote import UUID import qualified Annex import Locations diff --git a/Remote/Bup.hs b/Remote/Bup.hs index c40826e5eb..c011c979ca 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -19,8 +19,8 @@ import System.FilePath import Data.List.Utils import System.Cmd.Utils -import RemoteClass import Types +import Types.Remote import qualified GitRepo as Git import qualified Annex import UUID diff --git a/Remote/Directory.hs b/Remote/Directory.hs index dedab473f3..7b5917dca8 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -16,8 +16,8 @@ import Control.Monad.State (liftIO) import System.Directory hiding (copyFile) import System.FilePath -import RemoteClass import Types +import Types.Remote import qualified GitRepo as Git import qualified Annex import UUID diff --git a/Remote/Encryptable.hs b/Remote/Encryptable.hs index 68ecfd01e6..443f5cf83d 100644 --- a/Remote/Encryptable.hs +++ b/Remote/Encryptable.hs @@ -11,7 +11,7 @@ import qualified Data.Map as M import Control.Monad.State (liftIO) import Types -import RemoteClass +import Types.Remote import Crypto import qualified Annex import Messages diff --git a/Remote/Git.hs b/Remote/Git.hs index e6df6be46e..67d49df7d2 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -12,8 +12,8 @@ import Control.Monad.State (liftIO) import qualified Data.Map as M import System.Cmd.Utils -import RemoteClass import Types +import Types.Remote import qualified GitRepo as Git import qualified Annex import qualified AnnexQueue diff --git a/Remote/Hook.hs b/Remote/Hook.hs index dc4d392741..cc511965f8 100644 --- a/Remote/Hook.hs +++ b/Remote/Hook.hs @@ -18,8 +18,8 @@ import System.IO import System.IO.Error (try) import System.Exit -import RemoteClass import Types +import Types.Remote import qualified GitRepo as Git import qualified Annex import UUID diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index 9d32ad19b9..bf1bbd8707 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -16,8 +16,8 @@ import System.Directory import System.Posix.Files import System.Posix.Process -import RemoteClass import Types +import Types.Remote import qualified GitRepo as Git import qualified Annex import UUID diff --git a/Remote/S3real.hs b/Remote/S3real.hs index baf570593e..2479dfa023 100644 --- a/Remote/S3real.hs +++ b/Remote/S3real.hs @@ -24,8 +24,9 @@ import System.Environment import System.Posix.Files import System.Posix.Env (setEnv) -import RemoteClass import Types +import Types.Remote +import Types.Key import qualified GitRepo as Git import qualified Annex import UUID @@ -35,7 +36,6 @@ import Config import Remote.Special import Remote.Encryptable import Crypto -import Key import Content import Base64 diff --git a/Remote/Special.hs b/Remote/Special.hs index 53ac2c6eed..7d2ea1d704 100644 --- a/Remote/Special.hs +++ b/Remote/Special.hs @@ -13,7 +13,7 @@ import Data.String.Utils import Control.Monad.State (liftIO) import Types -import RemoteClass +import Types.Remote import qualified GitRepo as Git import qualified Annex import UUID diff --git a/Types.hs b/Types.hs index 503e27d312..6353f6da68 100644 --- a/Types.hs +++ b/Types.hs @@ -11,6 +11,6 @@ module Types ( Key ) where -import BackendClass import Annex -import Key +import Types.Backend +import Types.Key diff --git a/BackendClass.hs b/Types/Backend.hs similarity index 96% rename from BackendClass.hs rename to Types/Backend.hs index b2d8879c2f..8100eaf285 100644 --- a/BackendClass.hs +++ b/Types/Backend.hs @@ -7,9 +7,9 @@ - Licensed under the GNU GPL version 3 or higher. -} -module BackendClass where +module Types.Backend where -import Key +import Types.Key data Backend a = Backend { -- name of this backend diff --git a/CryptoTypes.hs b/Types/Crypto.hs similarity index 94% rename from CryptoTypes.hs rename to Types/Crypto.hs index ba22c4cbe8..a39a016b8b 100644 --- a/CryptoTypes.hs +++ b/Types/Crypto.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -module CryptoTypes where +module Types.Crypto where import Data.String.Utils diff --git a/Key.hs b/Types/Key.hs similarity index 95% rename from Key.hs rename to Types/Key.hs index e1d8ee34d0..1d9bf8e11c 100644 --- a/Key.hs +++ b/Types/Key.hs @@ -1,11 +1,13 @@ {- git-annex Key data type + - + - Most things should not need this, using Types instead - - Copyright 2011 Joey Hess - - Licensed under the GNU GPL version 3 or higher. -} -module Key ( +module Types.Key ( Key(..), stubKey, readKey, diff --git a/RemoteClass.hs b/Types/Remote.hs similarity index 96% rename from RemoteClass.hs rename to Types/Remote.hs index f954e4ff8f..01ced04ae1 100644 --- a/RemoteClass.hs +++ b/Types/Remote.hs @@ -1,4 +1,4 @@ -{- git-annex remotes class +{- git-annex remotes types - - Most things should not need this, using Remote instead - @@ -7,13 +7,13 @@ - Licensed under the GNU GPL version 3 or higher. -} -module RemoteClass where +module Types.Remote where import Control.Exception import Data.Map as M import qualified GitRepo as Git -import Key +import Types.Key type RemoteConfig = M.Map String String diff --git a/UUIDType.hs b/Types/UUID.hs similarity index 90% rename from UUIDType.hs rename to Types/UUID.hs index 8e207b444e..eb3497fa94 100644 --- a/UUIDType.hs +++ b/Types/UUID.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -module UUIDType where +module Types.UUID where -- might be nice to have a newtype, but lots of stuff treats uuids as strings type UUID = String diff --git a/UUID.hs b/UUID.hs index 33835e261b..f222f7a9d4 100644 --- a/UUID.hs +++ b/UUID.hs @@ -31,12 +31,12 @@ import Data.Maybe import qualified GitRepo as Git import Types +import Types.UUID import Locations import qualified Annex import Utility import qualified SysConfig import Config -import UUIDType configkey :: String configkey = "annex.uuid" diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs index 9278bce603..1e634e00e8 100644 --- a/Upgrade/V1.hs +++ b/Upgrade/V1.hs @@ -18,7 +18,7 @@ import System.Posix.Types import Data.Maybe import Data.Char -import Key +import Types.Key import Content import Types import Locations diff --git a/test.hs b/test.hs index 456c09060c..221607755a 100644 --- a/test.hs +++ b/test.hs @@ -31,7 +31,7 @@ import qualified Backend import qualified GitRepo as Git import qualified Locations import qualified Utility -import qualified BackendClass +import qualified Type.Backend import qualified Types import qualified GitAnnex import qualified LocationLog @@ -40,7 +40,7 @@ import qualified Trust import qualified Remote import qualified Content import qualified Command.DropUnused -import qualified Key +import qualified Type.Key import qualified Config import qualified Crypto