explicit exports
This commit is contained in:
parent
af82586adf
commit
ebc3fbe9ae
11 changed files with 58 additions and 39 deletions
11
Annex.hs
11
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" ""
|
||||
|
|
29
Backend.hs
29
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. -}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
module BackendFile (backend) where
|
||||
|
||||
import Backend
|
||||
import BackendType
|
||||
import GitRepo
|
||||
|
||||
backend = Backend {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
module BackendUrl (backend) where
|
||||
|
||||
import Backend
|
||||
import BackendType
|
||||
import GitRepo
|
||||
|
||||
backend = Backend {
|
||||
|
|
|
@ -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
|
||||
|
|
22
GitRepo.hs
22
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ++ "/"
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{- git-annex utility functions
|
||||
-}
|
||||
|
||||
module Utility where
|
||||
module Utility (
|
||||
withFileLocked,
|
||||
hGetContentsStrict,
|
||||
parentDir
|
||||
) where
|
||||
|
||||
import System.IO
|
||||
import System.Posix.IO
|
||||
|
|
Loading…
Add table
Reference in a new issue