summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-11 17:52:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-11 17:52:46 -0400
commitebc3fbe9ae2c5cc52332c77a92697c2517ce8263 (patch)
treef65c38ab3d452c0cde3d0d3b968c216f1ee30705
parentaf82586adff96f18fe768e432f501c647401262f (diff)
explicit exports
-rw-r--r--Annex.hs11
-rw-r--r--Backend.hs29
-rw-r--r--BackendChecksum.hs2
-rw-r--r--BackendFile.hs2
-rw-r--r--BackendList.hs8
-rw-r--r--BackendUrl.hs2
-rw-r--r--CmdLine.hs5
-rw-r--r--GitRepo.hs22
-rw-r--r--LocationLog.hs3
-rw-r--r--Locations.hs7
-rw-r--r--Utility.hs6
11 files changed, 58 insertions, 39 deletions
diff --git a/Annex.hs b/Annex.hs
index cedc478a4..8660febd5 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -1,7 +1,12 @@
{- git-annex toplevel code
-}
-module Annex where
+module Annex (
+ State,
+ startAnnex,
+ annexFile,
+ unannexFile
+) where
import System.Posix.Files
import System.Directory
@@ -34,7 +39,7 @@ annexDir repo key = do
- later. -}
startAnnex :: IO State
startAnnex = do
- r <- currentRepo
+ r <- gitRepoCurrent
config <- getConfig r
gitPrep r
return State {
@@ -46,7 +51,7 @@ startAnnex = do
getConfig :: GitRepo -> IO GitConfig
getConfig repo = do
-- a name can be configured, if none is, use the repository path
- name <- gitConfigGet "annex.name" (top repo)
+ name <- gitConfigGet "annex.name" (gitRepoTop repo)
-- default number of copies to keep of file contents is 1
numcopies <- gitConfigGet "annex.numcopies" "1"
backends <- gitConfigGet "annex.backends" ""
diff --git a/Backend.hs b/Backend.hs
index fb7d5666f..2d3ea42d6 100644
--- a/Backend.hs
+++ b/Backend.hs
@@ -16,32 +16,19 @@
- to store different files' contents in a given repository.
- -}
-module Backend where
+module Backend (
+ Key,
+ Backend, -- note only data type is exported, not destructors
+ lookupBackend,
+ storeFile,
+ dropFile
+) where
import System.Directory
import Locations
import GitRepo
import Utility
-
--- 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) ++ "\" }"
+import BackendType
{- Name of state file that holds the key for an annexed file,
- using a given backend. -}
diff --git a/BackendChecksum.hs b/BackendChecksum.hs
index e262962ca..e80dbe793 100644
--- a/BackendChecksum.hs
+++ b/BackendChecksum.hs
@@ -5,7 +5,7 @@ module BackendChecksum (backend) where
import qualified BackendFile
import Data.Digest.Pure.SHA
-import Backend
+import BackendType
import GitRepo
-- based on BackendFile just with a different key type
diff --git a/BackendFile.hs b/BackendFile.hs
index 831f80417..ae53f460f 100644
--- a/BackendFile.hs
+++ b/BackendFile.hs
@@ -3,7 +3,7 @@
module BackendFile (backend) where
-import Backend
+import BackendType
import GitRepo
backend = Backend {
diff --git a/BackendList.hs b/BackendList.hs
index c3a1b13a1..f733a44be 100644
--- a/BackendList.hs
+++ b/BackendList.hs
@@ -1,9 +1,13 @@
{- git-annex backend list
- -}
-module BackendList where
+module BackendList (
+ supportedBackends,
+ parseBackendList,
+ lookupBackendName
+) where
-import Backend
+import BackendType
-- When adding a new backend, import it here and add it to the list.
import qualified BackendFile
diff --git a/BackendUrl.hs b/BackendUrl.hs
index f08f0bdb4..4ba1dbadb 100644
--- a/BackendUrl.hs
+++ b/BackendUrl.hs
@@ -3,7 +3,7 @@
module BackendUrl (backend) where
-import Backend
+import BackendType
import GitRepo
backend = Backend {
diff --git a/CmdLine.hs b/CmdLine.hs
index 53707cd71..cc8708889 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -4,7 +4,10 @@
- System.Console.CmdArgs.Implicit but it is not yet packaged in Debian.
-}
-module CmdLine where
+module CmdLine (
+ argvToMode,
+ dispatch
+) where
import System.Console.GetOpt
import Annex
diff --git a/GitRepo.hs b/GitRepo.hs
index c26f752ef..d01ba642b 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -1,6 +1,15 @@
{- git repository handling -}
-module GitRepo where
+module GitRepo (
+ GitRepo,
+ gitRepoCurrent,
+ gitRepoTop,
+ gitDir,
+ gitRelative,
+ gitConfigGet,
+ gitAdd,
+ gitAttributes
+) where
import Directory
import System.Directory
@@ -13,7 +22,7 @@ import Utility
-- a git repository
data GitRepo = GitRepo {
- top :: FilePath,
+ gitRepoTop :: FilePath,
bare :: Bool
}
@@ -23,10 +32,13 @@ gitRepo dir = do
b <- isBareRepo dir
return GitRepo {
- top = dir,
+ gitRepoTop = dir,
bare = b
}
+{- Short name used in here for top of repo. -}
+top = gitRepoTop
+
{- Path to a repository's gitattributes file. -}
gitAttributes :: GitRepo -> IO String
gitAttributes repo = do
@@ -73,8 +85,8 @@ gitConfigGet name defaultValue =
return ret
{- Finds the current git repository, which may be in a parent directory. -}
-currentRepo :: IO GitRepo
-currentRepo = do
+gitRepoCurrent :: IO GitRepo
+gitRepoCurrent = do
cwd <- getCurrentDirectory
top <- seekUp cwd isRepoTop
case top of
diff --git a/LocationLog.hs b/LocationLog.hs
index 8e6b56fe8..31d454f10 100644
--- a/LocationLog.hs
+++ b/LocationLog.hs
@@ -16,7 +16,8 @@
- so the lines may be in arbitrary order, but it will never conflict.
-}
-module LocationLog where
+module LocationLog (
+) where
import Data.Time.Clock.POSIX
import Data.Time
diff --git a/Locations.hs b/Locations.hs
index 22a0db8e2..31bb3d9de 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -1,7 +1,10 @@
{- git-annex file locations
-}
-module Locations where
+module Locations (
+ gitStateDir,
+ stateLoc
+) where
import GitRepo
@@ -9,4 +12,4 @@ import GitRepo
- directory, in the git repository. -}
stateLoc = ".git-annex"
gitStateDir :: GitRepo -> FilePath
-gitStateDir repo = (top repo) ++ "/" ++ stateLoc ++ "/"
+gitStateDir repo = (gitRepoTop repo) ++ "/" ++ stateLoc ++ "/"
diff --git a/Utility.hs b/Utility.hs
index d1eb247d3..dea53967f 100644
--- a/Utility.hs
+++ b/Utility.hs
@@ -1,7 +1,11 @@
{- git-annex utility functions
-}
-module Utility where
+module Utility (
+ withFileLocked,
+ hGetContentsStrict,
+ parentDir
+) where
import System.IO
import System.Posix.IO