sim: add action repo sync command
This commit is contained in:
parent
2cbd3fb26b
commit
c420ec9364
3 changed files with 23 additions and 8 deletions
|
@ -221,6 +221,7 @@ data SimCommand
|
||||||
data SimAction
|
data SimAction
|
||||||
= ActionPull RemoteName
|
= ActionPull RemoteName
|
||||||
| ActionPush RemoteName
|
| ActionPush RemoteName
|
||||||
|
| ActionSync RemoteName
|
||||||
| ActionGetWanted RemoteName
|
| ActionGetWanted RemoteName
|
||||||
| ActionDropUnwanted (Maybe RemoteName)
|
| ActionDropUnwanted (Maybe RemoteName)
|
||||||
| ActionSendWanted RemoteName
|
| ActionSendWanted RemoteName
|
||||||
|
@ -413,6 +414,7 @@ applySimAction
|
||||||
-> Either String (Either (Annex (SimState SimRepo)) (SimState SimRepo))
|
-> Either String (Either (Annex (SimState SimRepo)) (SimState SimRepo))
|
||||||
applySimAction _r _u (ActionPull _remote) _st = undefined -- TODO
|
applySimAction _r _u (ActionPull _remote) _st = undefined -- TODO
|
||||||
applySimAction _r _u (ActionPush _remote) _st = undefined -- TODO
|
applySimAction _r _u (ActionPush _remote) _st = undefined -- TODO
|
||||||
|
applySimAction _r _u (ActionSync _remote) _st = undefined -- TODO
|
||||||
applySimAction r u (ActionGetWanted remote) st =
|
applySimAction r u (ActionGetWanted remote) st =
|
||||||
overFilesRemote r u remote S.member wanted go st
|
overFilesRemote r u remote S.member wanted go st
|
||||||
where
|
where
|
||||||
|
@ -593,6 +595,7 @@ randomAction u st = case M.lookup u (simConnections st) of
|
||||||
mkactions =
|
mkactions =
|
||||||
[ ActionPull
|
[ ActionPull
|
||||||
, ActionPush
|
, ActionPush
|
||||||
|
, ActionSync
|
||||||
, ActionGetWanted
|
, ActionGetWanted
|
||||||
, ActionDropUnwanted . Just
|
, ActionDropUnwanted . Just
|
||||||
, const (ActionDropUnwanted Nothing)
|
, const (ActionDropUnwanted Nothing)
|
||||||
|
|
|
@ -55,6 +55,8 @@ generateSimFile = unlines . map unwords . go
|
||||||
["action", repo, "pull", remote] : go rest
|
["action", repo, "pull", remote] : go rest
|
||||||
go (CommandAction (RepoName repo) (ActionPush (RemoteName remote)) : rest) =
|
go (CommandAction (RepoName repo) (ActionPush (RemoteName remote)) : rest) =
|
||||||
["action", repo, "push", remote] : go rest
|
["action", repo, "push", remote] : go rest
|
||||||
|
go (CommandAction (RepoName repo) (ActionSync (RemoteName remote)) : rest) =
|
||||||
|
["action", repo, "sync", remote] : go rest
|
||||||
go (CommandAction (RepoName repo) (ActionGetWanted (RemoteName remote)) : rest) =
|
go (CommandAction (RepoName repo) (ActionGetWanted (RemoteName remote)) : rest) =
|
||||||
["action", repo, "getwanted", remote] : go rest
|
["action", repo, "getwanted", remote] : go rest
|
||||||
go (CommandAction (RepoName repo) (ActionDropUnwanted (Just (RemoteName remote))) : rest) =
|
go (CommandAction (RepoName repo) (ActionDropUnwanted (Just (RemoteName remote))) : rest) =
|
||||||
|
@ -130,6 +132,9 @@ parseSimCommand ("action":repo:"pull":remote:[]) =
|
||||||
parseSimCommand ("action":repo:"push":remote:[]) =
|
parseSimCommand ("action":repo:"push":remote:[]) =
|
||||||
Right $ CommandAction (RepoName repo)
|
Right $ CommandAction (RepoName repo)
|
||||||
(ActionPush (RemoteName remote))
|
(ActionPush (RemoteName remote))
|
||||||
|
parseSimCommand ("action":repo:"sync":remote:[]) =
|
||||||
|
Right $ CommandAction (RepoName repo)
|
||||||
|
(ActionSync (RemoteName remote))
|
||||||
parseSimCommand ("action":repo:"getwanted":remote:[]) =
|
parseSimCommand ("action":repo:"getwanted":remote:[]) =
|
||||||
Right $ CommandAction (RepoName repo)
|
Right $ CommandAction (RepoName repo)
|
||||||
(ActionGetWanted (RemoteName remote))
|
(ActionGetWanted (RemoteName remote))
|
||||||
|
|
|
@ -163,14 +163,6 @@ as passed to "git annex sim" while a simulation is running.
|
||||||
On each step of the simulation, a simulated repository is selected
|
On each step of the simulation, a simulated repository is selected
|
||||||
at random, and a random action is performed in it.
|
at random, and a random action is performed in it.
|
||||||
|
|
||||||
* `action repo pull remote`
|
|
||||||
|
|
||||||
Simulate the equivilant of [[git-annex-pull]](1).
|
|
||||||
|
|
||||||
* `action repo push remote`
|
|
||||||
|
|
||||||
Simulate the equivilant of [[git-annex-push]](1).
|
|
||||||
|
|
||||||
* `action repo getwanted remote`
|
* `action repo getwanted remote`
|
||||||
|
|
||||||
Simulate the repository getting files it wants from the remote.
|
Simulate the repository getting files it wants from the remote.
|
||||||
|
@ -197,6 +189,21 @@ as passed to "git annex sim" while a simulation is running.
|
||||||
|
|
||||||
Simulate the repository pulling the git-annex branch from the remote.
|
Simulate the repository pulling the git-annex branch from the remote.
|
||||||
|
|
||||||
|
* `action repo pull remote`
|
||||||
|
|
||||||
|
Simulate the equivilant of [[git-annex-pull]](1), by combining
|
||||||
|
the actions gitpull, getwanted, and dropunwanted.
|
||||||
|
|
||||||
|
* `action repo push remote`
|
||||||
|
|
||||||
|
Simulate the equivilant of [[git-annex-push]](1) by combining
|
||||||
|
the actions sendwanted, dropunwanted, and gitpush.
|
||||||
|
|
||||||
|
* `action repo sync remote`
|
||||||
|
|
||||||
|
Simulate the equivilant of [[git-annex-sync]](1) by combining
|
||||||
|
the actions gitpull, getwanted, sendwanted, dropunwanted, and gitpush.
|
||||||
|
|
||||||
* `seed N`
|
* `seed N`
|
||||||
|
|
||||||
Sets the random seed to a given number. Using this should make the
|
Sets the random seed to a given number. Using this should make the
|
||||||
|
|
Loading…
Add table
Reference in a new issue