syncNewRemote is not only used for new remotes; rename to syncRemote

This commit is contained in:
Joey Hess 2013-04-08 15:36:09 -04:00
parent 4ba729461c
commit 1f1cddbaa7
7 changed files with 11 additions and 15 deletions

View file

@ -32,7 +32,7 @@ makeSshRemote forcersync sshdata mcost = do
r <- liftAnnex $ r <- liftAnnex $
addRemote $ maker (sshRepoName sshdata) sshurl addRemote $ maker (sshRepoName sshdata) sshurl
liftAnnex $ maybe noop (setRemoteCost r) mcost liftAnnex $ maybe noop (setRemoteCost r) mcost
syncNewRemote r syncRemote r
return r return r
where where
rsync = forcersync || rsyncOnly sshdata rsync = forcersync || rsyncOnly sshdata

View file

@ -204,9 +204,9 @@ manualPull currentbranch remotes = do
sendNetMessage $ Pushing (getXMPPClientID r) PushRequest sendNetMessage $ Pushing (getXMPPClientID r) PushRequest
return (catMaybes failed, haddiverged) return (catMaybes failed, haddiverged)
{- Start syncing a newly added remote, using a background thread. -} {- Start syncing a remote, using a background thread. -}
syncNewRemote :: Remote -> Assistant () syncRemote :: Remote -> Assistant ()
syncNewRemote remote = do syncRemote remote = do
updateSyncRemotes updateSyncRemotes
thread <- asIO $ do thread <- asIO $ do
reconnectRemotes False [remote] reconnectRemotes False [remote]

View file

@ -191,7 +191,7 @@ makeAWSRemote remotetype (AWSCreds ak sk) name setup config = do
makeSpecialRemote hostname remotetype config makeSpecialRemote hostname remotetype config
return remotename return remotename
setup r setup r
liftAssistant $ syncNewRemote r liftAssistant $ syncRemote r
redirect $ EditNewCloudRepositoryR $ Remote.uuid r redirect $ EditNewCloudRepositoryR $ Remote.uuid r
where where
{- AWS services use the remote name as the basis for a host {- AWS services use the remote name as the basis for a host

View file

@ -10,9 +10,9 @@
module Assistant.WebApp.Configurators.Local where module Assistant.WebApp.Configurators.Local where
import Assistant.WebApp.Common import Assistant.WebApp.Common
import Assistant.WebApp.Utility
import Assistant.WebApp.OtherRepos import Assistant.WebApp.OtherRepos
import Assistant.MakeRemote import Assistant.MakeRemote
import Assistant.Sync
import Init import Init
import qualified Git import qualified Git
import qualified Git.Construct import qualified Git.Construct
@ -166,7 +166,7 @@ postNewRepositoryR = page "Add another repository" (Just Configuration) $ do
getCombineRepositoryR :: FilePathAndUUID -> Handler RepHtml getCombineRepositoryR :: FilePathAndUUID -> Handler RepHtml
getCombineRepositoryR (FilePathAndUUID newrepopath newrepouuid) = do getCombineRepositoryR (FilePathAndUUID newrepopath newrepouuid) = do
r <- combineRepos newrepopath remotename r <- combineRepos newrepopath remotename
syncRemote r liftAssistant $ syncRemote r
redirect $ EditRepositoryR newrepouuid redirect $ EditRepositoryR newrepouuid
where where
remotename = takeFileName newrepopath remotename = takeFileName newrepopath
@ -244,7 +244,7 @@ getFinishAddDriveR drive = make >>= redirect . EditNewRepositoryR
u <- liftIO $ initRepo isnew False dir $ Just remotename u <- liftIO $ initRepo isnew False dir $ Just remotename
r <- combineRepos dir remotename r <- combineRepos dir remotename
liftAnnex $ setStandardGroup u TransferGroup liftAnnex $ setStandardGroup u TransferGroup
syncRemote r liftAssistant $ syncRemote r
return u return u
mountpoint = T.unpack (mountPoint drive) mountpoint = T.unpack (mountPoint drive)
dir = removableDriveRepository drive dir = removableDriveRepository drive

View file

@ -128,6 +128,6 @@ makeWebDavRemote name creds setup config = do
makeSpecialRemote name WebDAV.remote config makeSpecialRemote name WebDAV.remote config
return remotename return remotename
setup r setup r
liftAssistant $ syncNewRemote r liftAssistant $ syncRemote r
redirect $ EditNewCloudRepositoryR $ Remote.uuid r redirect $ EditNewCloudRepositoryR $ Remote.uuid r
#endif #endif

View file

@ -44,7 +44,7 @@ changeSyncable Nothing enable = do
| otherwise = PauseWatcher | otherwise = PauseWatcher
changeSyncable (Just r) True = do changeSyncable (Just r) True = do
changeSyncFlag r True changeSyncFlag r True
syncRemote r liftAssistant $ syncRemote r
changeSyncable (Just r) False = do changeSyncable (Just r) False = do
changeSyncFlag r False changeSyncFlag r False
liftAssistant $ updateSyncRemotes liftAssistant $ updateSyncRemotes
@ -64,10 +64,6 @@ changeSyncFlag r enabled = liftAnnex $ do
where where
key = Config.remoteConfig (Remote.repo r) "sync" key = Config.remoteConfig (Remote.repo r) "sync"
{- Start syncing remote, using a background thread. -}
syncRemote :: Remote -> Handler ()
syncRemote = liftAssistant . syncNewRemote
pauseTransfer :: Transfer -> Handler () pauseTransfer :: Transfer -> Handler ()
pauseTransfer = cancelTransfer True pauseTransfer = cancelTransfer True

View file

@ -60,7 +60,7 @@ makeXMPPGitRemote buddyname jid u = do
liftAnnex $ void remoteListRefresh liftAnnex $ void remoteListRefresh
remote' <- liftAnnex $ fromMaybe (error "failed to add remote") remote' <- liftAnnex $ fromMaybe (error "failed to add remote")
<$> Remote.byName (Just buddyname) <$> Remote.byName (Just buddyname)
syncNewRemote remote' syncRemote remote'
return True return True
{- Pushes over XMPP, communicating with a specific client. {- Pushes over XMPP, communicating with a specific client.