rename modules for data types into Types/ directory
This commit is contained in:
parent
971ab27e78
commit
703c437bd9
32 changed files with 61 additions and 59 deletions
8
Annex.hs
8
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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.
|
||||
-
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" $
|
||||
|
|
|
@ -41,7 +41,7 @@ import qualified Annex
|
|||
import qualified AnnexQueue
|
||||
import Utility
|
||||
import StatFS
|
||||
import Key
|
||||
import Types.Key
|
||||
import DataUnits
|
||||
import Config
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -36,7 +36,7 @@ import Word
|
|||
import Data.Hash.MD5
|
||||
|
||||
import Types
|
||||
import Key
|
||||
import Types.Key
|
||||
import qualified GitRepo as Git
|
||||
|
||||
{- Conventions:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
4
Types.hs
4
Types.hs
|
@ -11,6 +11,6 @@ module Types (
|
|||
Key
|
||||
) where
|
||||
|
||||
import BackendClass
|
||||
import Annex
|
||||
import Key
|
||||
import Types.Backend
|
||||
import Types.Key
|
||||
|
|
|
@ -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
|
|
@ -5,7 +5,7 @@
|
|||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module CryptoTypes where
|
||||
module Types.Crypto where
|
||||
|
||||
import Data.String.Utils
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
{- git-annex Key data type
|
||||
-
|
||||
- Most things should not need this, using Types instead
|
||||
-
|
||||
- Copyright 2011 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Key (
|
||||
module Types.Key (
|
||||
Key(..),
|
||||
stubKey,
|
||||
readKey,
|
|
@ -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
|
||||
|
|
@ -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
|
2
UUID.hs
2
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"
|
||||
|
|
|
@ -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
|
||||
|
|
4
test.hs
4
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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue