rename file

This commit is contained in:
Joey Hess 2011-03-15 22:04:50 -04:00
parent f27df5e658
commit 4594bd51c1
12 changed files with 21 additions and 22 deletions

View file

@ -25,7 +25,7 @@ import Data.Maybe
import qualified GitRepo as Git import qualified GitRepo as Git
import qualified GitQueue import qualified GitQueue
import qualified BackendTypes import qualified BackendClass
import Utility import Utility
-- git-annex's monad -- git-annex's monad
@ -34,8 +34,8 @@ type Annex = StateT AnnexState IO
-- internal state storage -- internal state storage
data AnnexState = AnnexState data AnnexState = AnnexState
{ repo :: Git.Repo { repo :: Git.Repo
, backends :: [BackendTypes.Backend Annex] , backends :: [BackendClass.Backend Annex]
, supportedBackends :: [BackendTypes.Backend Annex] , supportedBackends :: [BackendClass.Backend Annex]
, repoqueue :: GitQueue.Queue , repoqueue :: GitQueue.Queue
, quiet :: Bool , quiet :: Bool
, force :: Bool , force :: Bool
@ -47,7 +47,7 @@ data AnnexState = AnnexState
, remotesread :: Bool , remotesread :: Bool
} deriving (Show) } deriving (Show)
newState :: Git.Repo -> [BackendTypes.Backend Annex] -> AnnexState newState :: Git.Repo -> [BackendClass.Backend Annex] -> AnnexState
newState gitrepo allbackends = AnnexState newState gitrepo allbackends = AnnexState
{ repo = gitrepo { repo = gitrepo
, backends = [] , backends = []
@ -64,7 +64,7 @@ newState gitrepo allbackends = AnnexState
} }
{- Create and returns an Annex state object for the specified git repo. -} {- Create and returns an Annex state object for the specified git repo. -}
new :: Git.Repo -> [BackendTypes.Backend Annex] -> IO AnnexState new :: Git.Repo -> [BackendClass.Backend Annex] -> IO AnnexState
new gitrepo allbackends = do new gitrepo allbackends = do
gitrepo' <- liftIO $ Git.configRead gitrepo gitrepo' <- liftIO $ Git.configRead gitrepo
return $ newState gitrepo' allbackends return $ newState gitrepo' allbackends

View file

@ -40,7 +40,7 @@ import qualified GitRepo as Git
import qualified Annex import qualified Annex
import Types import Types
import Key import Key
import qualified BackendTypes as B import qualified BackendClass as B
import Messages import Messages
{- List of backends in the order to try them when storing a new key. -} {- List of backends in the order to try them when storing a new key. -}

View file

@ -18,7 +18,7 @@ import Control.Monad.State
import System.Directory import System.Directory
import Data.List import Data.List
import BackendTypes import BackendClass
import LocationLog import LocationLog
import Locations import Locations
import qualified Remotes import qualified Remotes

View file

@ -16,7 +16,7 @@ import Data.Maybe
import System.Posix.Files import System.Posix.Files
import qualified Backend.File import qualified Backend.File
import BackendTypes import BackendClass
import Messages import Messages
import qualified Annex import qualified Annex
import Locations import Locations

View file

@ -11,7 +11,7 @@ import Control.Monad.State (liftIO)
import Data.String.Utils import Data.String.Utils
import Types import Types
import BackendTypes import BackendClass
import Utility import Utility
import Messages import Messages

View file

@ -14,7 +14,7 @@ import System.Directory
import Data.Maybe import Data.Maybe
import qualified Backend.File import qualified Backend.File
import BackendTypes import BackendClass
import Locations import Locations
import qualified Annex import qualified Annex
import Content import Content

View file

@ -7,7 +7,7 @@
- Licensed under the GNU GPL version 3 or higher. - Licensed under the GNU GPL version 3 or higher.
-} -}
module BackendTypes where module BackendClass where
import Key import Key

View file

@ -17,7 +17,7 @@ import Data.List
import Types import Types
import qualified Backend import qualified Backend
import qualified BackendTypes import qualified BackendClass
import Messages import Messages
import qualified Annex import qualified Annex
import qualified GitRepo as Git import qualified GitRepo as Git
@ -237,7 +237,7 @@ cmdlineKey = do
backends <- Backend.list backends <- Backend.list
return $ stubKey { return $ stubKey {
keyName = kname k, keyName = kname k,
keyBackendName = BackendTypes.name $ head backends keyBackendName = BackendClass.name $ head backends
} }
where where
kname Nothing = badkey kname Nothing = badkey

View file

@ -13,7 +13,7 @@ import System.Exit
import Command import Command
import Content import Content
import qualified Backend import qualified Backend
import qualified BackendTypes import qualified BackendClass
import Key import Key
command :: [Command] command :: [Command]
@ -28,7 +28,7 @@ start keyname = do
backends <- Backend.list backends <- Backend.list
let key = stubKey { let key = stubKey {
keyName = keyname, keyName = keyname,
keyBackendName = BackendTypes.name (head backends) keyBackendName = BackendClass.name (head backends)
} }
error "BROKEN. fixme!" error "BROKEN. fixme!"
present <- inAnnex key present <- inAnnex key

3
Key.hs
View file

@ -76,11 +76,10 @@ instance Arbitrary Key where
arbitrary = do arbitrary = do
n <- arbitrary n <- arbitrary
b <- elements ['A'..'Z'] b <- elements ['A'..'Z']
s <- arbitrary
return $ Key { return $ Key {
keyName = n, keyName = n,
keyBackendName = [b], keyBackendName = [b],
keySize = s, keySize = Nothing,
keyMtime = Nothing keyMtime = Nothing
} }

View file

@ -11,6 +11,6 @@ module Types (
Key Key
) where ) where
import BackendTypes import BackendClass
import Annex import Annex
import Key import Key

View file

@ -29,7 +29,7 @@ import qualified Backend
import qualified GitRepo as Git import qualified GitRepo as Git
import qualified Locations import qualified Locations
import qualified Utility import qualified Utility
import qualified BackendTypes import qualified BackendClass
import qualified Types import qualified Types
import qualified GitAnnex import qualified GitAnnex
import qualified LocationLog import qualified LocationLog
@ -120,8 +120,8 @@ test_add = "git-annex add" ~: TestList [basic, sha1dup]
test_setkey :: Test test_setkey :: Test
test_setkey = "git-annex setkey/fromkey" ~: TestCase $ inmainrepo $ do test_setkey = "git-annex setkey/fromkey" ~: TestCase $ inmainrepo $ do
writeFile tmp $ content sha1annexedfile writeFile tmp $ content sha1annexedfile
r <- annexeval $ BackendTypes.getKey backendSHA1 tmp r <- annexeval $ BackendClass.getKey backendSHA1 tmp
let sha1 = BackendTypes.keyName $ fromJust r let sha1 = Key.keyName $ fromJust r
git_annex "setkey" ["-q", "--backend", "SHA1", "--key", sha1, tmp] @? "setkey failed" git_annex "setkey" ["-q", "--backend", "SHA1", "--key", sha1, tmp] @? "setkey failed"
git_annex "fromkey" ["-q", "--backend", "SHA1", "--key", sha1, sha1annexedfile] @? "fromkey failed" git_annex "fromkey" ["-q", "--backend", "SHA1", "--key", sha1, sha1annexedfile] @? "fromkey failed"
Utility.boolSystem "git" [Utility.Params "commit -q -a -m commit"] @? "git commit failed" Utility.boolSystem "git" [Utility.Params "commit -q -a -m commit"] @? "git commit failed"
@ -439,7 +439,7 @@ test_unused = "git-annex unused/dropunused" ~: intmpclonerepo $ do
checkunused [annexedfilekey, sha1annexedfilekey] checkunused [annexedfilekey, sha1annexedfilekey]
-- good opportunity to test dropkey also -- good opportunity to test dropkey also
git_annex "dropkey" ["-q", "--force", BackendTypes.keyName annexedfilekey] git_annex "dropkey" ["-q", "--force", Key.keyName annexedfilekey]
@? "dropkey failed" @? "dropkey failed"
checkunused [sha1annexedfilekey] checkunused [sha1annexedfilekey]