This commit is contained in:
Joey Hess 2010-10-12 15:44:54 -04:00
parent 4fbdb197d5
commit e53900a545
3 changed files with 42 additions and 6 deletions

View file

@ -5,7 +5,12 @@ module Annex (
State,
startAnnex,
annexFile,
unannexFile
unannexFile,
annexGetFile,
annexWantFile,
annexDropFile,
annexPushRepo,
annexPullRepo
) where
import System.Posix.Files
@ -83,6 +88,32 @@ unannexFile state file = do
renameFile src file
return ()
{- Transfers the file from a remote. -}
annexGetFile :: State -> FilePath -> IO ()
annexGetFile state file = do
alreadyannexed <- lookupBackend (backends state) (repo state) file
case (alreadyannexed) of
Nothing -> error $ "not annexed " ++ file
Just _ -> do error "not implemented" -- TODO
-- 1. find remote with file
-- 2. copy file from remote
{- Indicates a file is wanted. -}
annexWantFile :: State -> FilePath -> IO ()
annexWantFile state file = do error "not implemented" -- TODO
{- Indicates a file is now wanted. -}
annexDropFile :: State -> FilePath -> IO ()
annexDropFile state file = do error "not implemented" -- TODO
{- Pushes all files to a remote repository. -}
annexPushRepo :: State -> String -> IO ()
annexPushRepo state reponame = do error "not implemented" -- TODO
{- Pulls all files from a remote repository. -}
annexPullRepo :: State -> String -> IO ()
annexPullRepo state reponame = do error "not implemented" -- TODO
{- Sets up a git repo for git-annex. May be called repeatedly. -}
gitPrep :: GitRepo -> IO ()
gitPrep repo = do

View file

@ -39,8 +39,12 @@ argvToMode argv = do
where header = "Usage: git-annex [mode] file"
dispatch :: State -> Mode -> FilePath -> IO ()
dispatch state mode file = do
dispatch state mode item = do
case (mode) of
Add -> annexFile state file
Unannex -> unannexFile state file
_ -> error "not implemented"
Add -> annexFile state item
Push -> annexPushRepo state item
Pull -> annexPullRepo state item
Want -> annexWantFile state item
Get -> annexGetFile state item
Drop -> annexDropFile state item
Unannex -> unannexFile state item

View file

@ -34,5 +34,6 @@ prepUUID repo =
then do
uuid <- genUUID
gitRun repo ["config", configkey, uuid]
gitConfigRead repo -- return new repo with updated config
-- return new repo with updated config
gitConfigRead repo
else return repo