ActionGetWanted working
The sim is now basically working!
This commit is contained in:
parent
07f54668c4
commit
a387f40ffb
2 changed files with 114 additions and 65 deletions
|
@ -5,11 +5,12 @@
|
|||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Command.Sim where
|
||||
|
||||
import Command
|
||||
import Annex.Sim
|
||||
import qualified Annex
|
||||
import Utility.Tmp.Dir
|
||||
|
||||
import System.Random
|
||||
|
@ -23,16 +24,18 @@ seek :: CmdParams -> CommandSeek
|
|||
seek _ = do
|
||||
rng <- initStdGen
|
||||
repobyname <- mkGetExistingRepoByName
|
||||
r <- Annex.gitRepo
|
||||
withTmpDir "sim" $ \tmpdir -> do
|
||||
let st = emptySimState rng repobyname
|
||||
let getpath = GetSimRepoPath $ \u -> tmpdir </> fromUUID u
|
||||
let st = emptySimState rng repobyname getpath
|
||||
st' <- runSimCommand (CommandInit (RepoName "foo")) st
|
||||
>>= runSimCommand (CommandTrustLevel (RepoName "foo") "trusted")
|
||||
>>= runSimCommand (CommandUse (RepoName "bar") "here")
|
||||
>>= runSimCommand (CommandConnect (RepoName "foo") (RemoteName "bar"))
|
||||
>>= runSimCommand (CommandAdd "foo" 100000 (RepoName "foo"))
|
||||
let simdir = \u -> tmpdir </> fromUUID u
|
||||
st'' <- liftIO $ updateSimRepos r simdir st'
|
||||
>>= runSimCommand (CommandConnect (RepoName "bar") (RemoteName "foo"))
|
||||
>>= runSimCommand (CommandAdd "bigfile" 1000000 (RepoName "foo"))
|
||||
>>= runSimCommand (CommandAction (RepoName "bar") (ActionGitPull (RemoteName "foo")))
|
||||
>>= runSimCommand (CommandAction (RepoName "bar") (ActionGetWanted (RemoteName "foo")))
|
||||
st'' <- liftIO $ updateSimRepos st'
|
||||
liftIO $ print tmpdir
|
||||
_ <- liftIO $ getLine
|
||||
return ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue