gratuitous rename
This commit is contained in:
parent
0382d26cdb
commit
f3dcc8489d
11 changed files with 33 additions and 35 deletions
30
Annex.hs
30
Annex.hs
|
@ -17,17 +17,17 @@ import Control.Monad.State
|
|||
|
||||
import qualified GitRepo as Git
|
||||
import Types
|
||||
import qualified BackendTypes as Backend
|
||||
import qualified TypeInternals as Internals
|
||||
|
||||
{- Create and returns an Annex state object for the specified git repo.
|
||||
-}
|
||||
new :: Git.Repo -> [Backend] -> IO AnnexState
|
||||
new gitrepo allbackends = do
|
||||
let s = Backend.AnnexState {
|
||||
Backend.repo = gitrepo,
|
||||
Backend.backends = [],
|
||||
Backend.supportedBackends = allbackends,
|
||||
Backend.flags = []
|
||||
let s = Internals.AnnexState {
|
||||
Internals.repo = gitrepo,
|
||||
Internals.backends = [],
|
||||
Internals.supportedBackends = allbackends,
|
||||
Internals.flags = []
|
||||
}
|
||||
(_,s') <- Annex.run s (prep gitrepo)
|
||||
return s'
|
||||
|
@ -44,34 +44,34 @@ run state action = runStateT (action) state
|
|||
gitRepo :: Annex Git.Repo
|
||||
gitRepo = do
|
||||
state <- get
|
||||
return (Backend.repo state)
|
||||
return (Internals.repo state)
|
||||
gitRepoChange :: Git.Repo -> Annex ()
|
||||
gitRepoChange r = do
|
||||
state <- get
|
||||
put state { Backend.repo = r }
|
||||
put state { Internals.repo = r }
|
||||
return ()
|
||||
backends :: Annex [Backend]
|
||||
backends = do
|
||||
state <- get
|
||||
return (Backend.backends state)
|
||||
return (Internals.backends state)
|
||||
backendsChange :: [Backend] -> Annex ()
|
||||
backendsChange b = do
|
||||
state <- get
|
||||
put state { Backend.backends = b }
|
||||
put state { Internals.backends = b }
|
||||
return ()
|
||||
supportedBackends :: Annex [Backend]
|
||||
supportedBackends = do
|
||||
state <- get
|
||||
return (Backend.supportedBackends state)
|
||||
return (Internals.supportedBackends state)
|
||||
flagIsSet :: Flag -> Annex Bool
|
||||
flagIsSet flag = do
|
||||
state <- get
|
||||
return $ elem flag $ Backend.flags state
|
||||
return $ elem flag $ Internals.flags state
|
||||
flagChange :: Flag -> Bool -> Annex ()
|
||||
flagChange flag set = do
|
||||
state <- get
|
||||
let f = filter (/= flag) $ Backend.flags state
|
||||
let f = filter (/= flag) $ Internals.flags state
|
||||
if (set)
|
||||
then put state { Backend.flags = (flag:f) }
|
||||
else put state { Backend.flags = f }
|
||||
then put state { Internals.flags = (flag:f) }
|
||||
else put state { Internals.flags = f }
|
||||
return ()
|
||||
|
|
14
Backend.hs
14
Backend.hs
|
@ -33,7 +33,7 @@ import qualified GitRepo as Git
|
|||
import qualified Annex
|
||||
import Utility
|
||||
import Types
|
||||
import qualified BackendTypes as B
|
||||
import qualified TypeInternals as Internals
|
||||
|
||||
{- List of backends in the order to try them when storing a new key. -}
|
||||
backendList :: Annex [Backend]
|
||||
|
@ -59,7 +59,7 @@ lookupBackendName all s =
|
|||
if ((length matches) /= 1)
|
||||
then error $ "unknown backend " ++ s
|
||||
else matches !! 0
|
||||
where matches = filter (\b -> s == B.name b) all
|
||||
where matches = filter (\b -> s == Internals.name b) all
|
||||
|
||||
{- Attempts to store a file in one of the backends. -}
|
||||
storeFileKey :: FilePath -> Annex (Maybe (Key, Backend))
|
||||
|
@ -70,11 +70,11 @@ storeFileKey file = do
|
|||
storeFileKey' b file relfile
|
||||
storeFileKey' [] _ _ = return Nothing
|
||||
storeFileKey' (b:bs) file relfile = do
|
||||
try <- (B.getKey b) relfile
|
||||
try <- (Internals.getKey b) relfile
|
||||
case (try) of
|
||||
Nothing -> nextbackend
|
||||
Just key -> do
|
||||
stored <- (B.storeFileKey b) file key
|
||||
stored <- (Internals.storeFileKey b) file key
|
||||
if (not stored)
|
||||
then nextbackend
|
||||
else do
|
||||
|
@ -85,17 +85,17 @@ storeFileKey' (b:bs) file relfile = do
|
|||
{- Attempts to retrieve an key from one of the backends, saving it to
|
||||
- a specified location. -}
|
||||
retrieveKeyFile :: Backend -> Key -> FilePath -> Annex Bool
|
||||
retrieveKeyFile backend key dest = (B.retrieveKeyFile backend) key dest
|
||||
retrieveKeyFile backend key dest = (Internals.retrieveKeyFile backend) key dest
|
||||
|
||||
{- Removes a key from a backend. -}
|
||||
removeKey :: Backend -> Key -> Annex Bool
|
||||
removeKey backend key = (B.removeKey backend) key
|
||||
removeKey backend key = (Internals.removeKey backend) key
|
||||
|
||||
{- Checks if a backend has its key. -}
|
||||
hasKey :: Key -> Annex Bool
|
||||
hasKey key = do
|
||||
all <- Annex.supportedBackends
|
||||
(B.hasKey (lookupBackendName all $ backendName key)) key
|
||||
(Internals.hasKey (lookupBackendName all $ backendName key)) key
|
||||
|
||||
{- Looks up the key and backend corresponding to an annexed file,
|
||||
- by examining what the file symlinks to. -}
|
||||
|
|
|
@ -16,7 +16,7 @@ import System.Cmd
|
|||
import System.Exit
|
||||
import Control.Exception
|
||||
|
||||
import BackendTypes
|
||||
import TypeInternals
|
||||
import LocationLog
|
||||
import Locations
|
||||
import qualified Remotes
|
||||
|
|
|
@ -6,7 +6,7 @@ module Backend.SHA1 (backend) where
|
|||
import Data.Digest.Pure.SHA
|
||||
|
||||
import qualified Backend.File
|
||||
import BackendTypes
|
||||
import TypeInternals
|
||||
|
||||
backend = Backend.File.backend {
|
||||
name = "SHA1",
|
||||
|
|
|
@ -8,7 +8,7 @@ import Data.String.Utils
|
|||
import System.Cmd
|
||||
import System.Exit
|
||||
|
||||
import BackendTypes
|
||||
import TypeInternals
|
||||
import Core
|
||||
|
||||
backend = Backend {
|
||||
|
|
|
@ -9,7 +9,7 @@ import System.Posix.Files
|
|||
import qualified Data.ByteString.Lazy.Char8 as B
|
||||
|
||||
import qualified Backend.File
|
||||
import BackendTypes
|
||||
import TypeInternals
|
||||
import Utility
|
||||
|
||||
backend = Backend.File.backend {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
module BackendList (allBackends) where
|
||||
|
||||
import BackendTypes
|
||||
|
||||
-- When adding a new backend, import it here and add it to the list.
|
||||
import qualified Backend.WORM
|
||||
import qualified Backend.SHA1
|
||||
|
|
|
@ -21,7 +21,7 @@ import LocationLog
|
|||
import Types
|
||||
import Core
|
||||
import qualified Remotes
|
||||
import qualified BackendTypes
|
||||
import qualified TypeInternals
|
||||
|
||||
data CmdWants = FilesInGit | FilesNotInGit | RepoName | SingleString
|
||||
data Command = Command {
|
||||
|
@ -87,7 +87,7 @@ parseCmd argv state = do
|
|||
[] -> error usage
|
||||
[Command _ action want _] -> do
|
||||
f <- findWanted want (drop 1 params)
|
||||
(BackendTypes.repo state)
|
||||
(TypeInternals.repo state)
|
||||
return (flags, map action $ filter notstate f)
|
||||
where
|
||||
-- never include files from the state directory
|
||||
|
|
|
@ -14,7 +14,7 @@ module Locations (
|
|||
import Data.String.Utils
|
||||
|
||||
import Types
|
||||
import qualified BackendTypes as Backend
|
||||
import qualified TypeInternals as Internals
|
||||
import qualified GitRepo as Git
|
||||
|
||||
{- Long-term, cross-repo state is stored in files inside the .git-annex
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{- git-annex backend data types
|
||||
{- git-annex internal data types
|
||||
-
|
||||
- Mostly only backend implementations should need to import this.
|
||||
- Most things should not need this, using Types and/or Annex instead.
|
||||
-}
|
||||
|
||||
module BackendTypes where
|
||||
module TypeInternals where
|
||||
|
||||
import Control.Monad.State (StateT)
|
||||
import Data.String.Utils
|
2
Types.hs
2
Types.hs
|
@ -10,4 +10,4 @@ module Types (
|
|||
Flag(..),
|
||||
) where
|
||||
|
||||
import BackendTypes
|
||||
import TypeInternals
|
||||
|
|
Loading…
Reference in a new issue