simulated repository construction working

This commit is contained in:
Joey Hess 2024-09-09 10:59:01 -04:00
parent a2c0d5e4a9
commit ec7f1f2736
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 64 additions and 1 deletions

View file

@ -9,6 +9,10 @@ module Command.Sim where
import Command
import Annex.Sim
import qualified Annex
import Utility.Tmp.Dir
import System.Random
cmd :: Command
cmd = command "sim" SectionTesting
@ -16,4 +20,18 @@ cmd = command "sim" SectionTesting
paramCommand (withParams seek)
seek :: CmdParams -> CommandSeek
seek = undefined
seek _ = do
rng <- initStdGen
repobyname <- mkGetExistingRepoByName
r <- Annex.gitRepo
withTmpDir "sim" $ \tmpdir -> do
let st = emptySimState rng repobyname
st' <- runSimCommand (CommandInit (RepoName "foo")) st
>>= runSimCommand (CommandTrustLevel (RepoName "foo") "trusted")
>>= runSimCommand (CommandUse (RepoName "bar") "here")
let simdir = \u -> tmpdir </> fromUUID u
st'' <- liftIO $ updateSimRepos r simdir st'
liftIO $ print tmpdir
_ <- liftIO $ getLine
return ()