summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex.hs19
-rw-r--r--Backend.hs18
-rw-r--r--BackendChecksum.hs3
-rw-r--r--BackendFile.hs3
-rw-r--r--BackendList.hs3
-rw-r--r--BackendUrl.hs3
-rw-r--r--CmdLine.hs1
-rw-r--r--GitRepo.hs7
-rw-r--r--LocationLog.hs1
-rw-r--r--Locations.hs7
-rw-r--r--Types.hs39
11 files changed, 49 insertions, 55 deletions
diff --git a/Annex.hs b/Annex.hs
index e3956cbf2..cedc478a4 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -8,11 +8,28 @@ import System.Directory
import GitRepo
import Utility
import Locations
-import Types
import Backend
import BackendList
import LocationLog
+-- git-annex's runtime state
+data State = State {
+ repo :: GitRepo,
+ gitconfig :: GitConfig
+}
+
+data GitConfig = GitConfig {
+ annex_name :: String,
+ annex_numcopies :: Int,
+ annex_backends :: [Backend]
+}
+
+{- An annexed file's content is stored somewhere under .git/annex/ -}
+annexDir :: GitRepo -> Key -> IO FilePath
+annexDir repo key = do
+ dir <- gitDir repo
+ return $ dir ++ "/annex/" ++ key
+
{- On startup, examine the git repo, prepare it, and record state for
- later. -}
startAnnex :: IO State
diff --git a/Backend.hs b/Backend.hs
index eb4a948c4..fb7d5666f 100644
--- a/Backend.hs
+++ b/Backend.hs
@@ -22,7 +22,23 @@ import System.Directory
import Locations
import GitRepo
import Utility
-import Types
+
+-- annexed filenames are mapped into keys
+type Key = FilePath
+
+-- this structure represents a key/value backend
+data Backend = Backend {
+ -- name of this backend
+ name :: String,
+ -- converts a filename to a key
+ getKey :: GitRepo -> FilePath -> IO (Maybe Key),
+ -- stores a file's contents to a key
+ storeFileKey :: GitRepo -> FilePath -> Key -> IO Bool,
+ -- retrieves a key's contents to a file
+ retrieveKeyFile :: Key -> FilePath -> IO Bool,
+ -- removes a key
+ removeKey :: Key -> IO Bool
+}
instance Show Backend where
show backend = "Backend { name =\"" ++ (name backend) ++ "\" }"
diff --git a/BackendChecksum.hs b/BackendChecksum.hs
index 18ff0cb57..e262962ca 100644
--- a/BackendChecksum.hs
+++ b/BackendChecksum.hs
@@ -3,9 +3,10 @@
module BackendChecksum (backend) where
-import Types
import qualified BackendFile
import Data.Digest.Pure.SHA
+import Backend
+import GitRepo
-- based on BackendFile just with a different key type
backend = BackendFile.backend {
diff --git a/BackendFile.hs b/BackendFile.hs
index de60803c3..831f80417 100644
--- a/BackendFile.hs
+++ b/BackendFile.hs
@@ -3,7 +3,8 @@
module BackendFile (backend) where
-import Types
+import Backend
+import GitRepo
backend = Backend {
name = "file",
diff --git a/BackendList.hs b/BackendList.hs
index 77e4bd817..c3a1b13a1 100644
--- a/BackendList.hs
+++ b/BackendList.hs
@@ -3,8 +3,9 @@
module BackendList where
+import Backend
+
-- When adding a new backend, import it here and add it to the list.
-import Types
import qualified BackendFile
import qualified BackendChecksum
import qualified BackendUrl
diff --git a/BackendUrl.hs b/BackendUrl.hs
index ddeab9e04..f08f0bdb4 100644
--- a/BackendUrl.hs
+++ b/BackendUrl.hs
@@ -3,7 +3,8 @@
module BackendUrl (backend) where
-import Types
+import Backend
+import GitRepo
backend = Backend {
name = "url",
diff --git a/CmdLine.hs b/CmdLine.hs
index c956f29a5..53707cd71 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -7,7 +7,6 @@
module CmdLine where
import System.Console.GetOpt
-import Types
import Annex
data Mode = Add | Push | Pull | Want | Get | Drop | Unannex
diff --git a/GitRepo.hs b/GitRepo.hs
index 3a8a8110d..c26f752ef 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -10,7 +10,12 @@ import System.IO
import Data.String.Utils
import Control.Exception
import Utility
-import Types
+
+-- a git repository
+data GitRepo = GitRepo {
+ top :: FilePath,
+ bare :: Bool
+}
{- GitRepo constructor -}
gitRepo :: FilePath -> IO GitRepo
diff --git a/LocationLog.hs b/LocationLog.hs
index 195596bda..8e6b56fe8 100644
--- a/LocationLog.hs
+++ b/LocationLog.hs
@@ -28,7 +28,6 @@ import Data.Char
import GitRepo
import Utility
import Locations
-import Types
data LogLine = LogLine {
date :: POSIXTime,
diff --git a/Locations.hs b/Locations.hs
index b25e99197..22a0db8e2 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -3,15 +3,8 @@
module Locations where
-import Types
import GitRepo
-{- An annexed file's content is stored somewhere under .git/annex/ -}
-annexDir :: GitRepo -> Key -> IO FilePath
-annexDir repo key = do
- dir <- gitDir repo
- return $ dir ++ "/annex/" ++ key
-
{- Long-term, cross-repo state is stored in files inside the .git-annex
- directory, in the git repository. -}
stateLoc = ".git-annex"
diff --git a/Types.hs b/Types.hs
deleted file mode 100644
index 5c5a428d5..000000000
--- a/Types.hs
+++ /dev/null
@@ -1,39 +0,0 @@
-{- git-annex data types
- - -}
-
-module Types where
-
--- annexed filenames are mapped into keys
-type Key = String
-
--- this structure represents a key/value backend
-data Backend = Backend {
- -- name of this backend
- name :: String,
- -- converts a filename to a key
- getKey :: GitRepo -> FilePath -> IO (Maybe Key),
- -- stores a file's contents to a key
- storeFileKey :: GitRepo -> FilePath -> Key -> IO Bool,
- -- retrieves a key's contents to a file
- retrieveKeyFile :: Key -> FilePath -> IO Bool,
- -- removes a key
- removeKey :: Key -> IO Bool
-}
-
--- a git repository
-data GitRepo = GitRepo {
- top :: FilePath,
- bare :: Bool
-}
-
--- git-annex's runtime state
-data State = State {
- repo :: GitRepo,
- gitconfig :: GitConfig
-}
-
-data GitConfig = GitConfig {
- annex_name :: String,
- annex_numcopies :: Int,
- annex_backends :: [Backend]
-}