annex.autocommit
New setting, can be used to disable autocommit of changed files by the assistant, while it still does data syncing and other tasks. Also wired into webapp UI
This commit is contained in:
parent
d3d791c7e7
commit
5cd152b8a9
9 changed files with 87 additions and 13 deletions
|
@ -14,6 +14,7 @@ import Assistant.DaemonStatus
|
|||
import Assistant.WebApp.Notifications
|
||||
import Assistant.WebApp.Utility
|
||||
import Assistant.WebApp.Configurators.Local
|
||||
import qualified Annex
|
||||
import qualified Remote
|
||||
import qualified Types.Remote as Remote
|
||||
import Annex.UUID (getUUID)
|
||||
|
@ -136,10 +137,18 @@ repoList reposelector
|
|||
rs <- filter wantedrepo . syncRemotes
|
||||
<$> liftAssistant getDaemonStatus
|
||||
runAnnex [] $ do
|
||||
u <- getUUID
|
||||
let l = map Remote.uuid rs
|
||||
let l' = if includeHere reposelector then u : l else l
|
||||
return $ zip l' $ map mkSyncingRepoActions l'
|
||||
let us = map Remote.uuid rs
|
||||
let l = zip us $ map mkSyncingRepoActions us
|
||||
if includeHere reposelector
|
||||
then do
|
||||
u <- getUUID
|
||||
autocommit <- annexAutoCommit <$> Annex.getGitConfig
|
||||
let hereactions = if autocommit
|
||||
then mkSyncingRepoActions u
|
||||
else mkNotSyncingRepoActions u
|
||||
let here = (u, hereactions)
|
||||
return $ here : l
|
||||
else return l
|
||||
rest = runAnnex [] $ do
|
||||
m <- readRemoteLog
|
||||
unconfigured <- map snd . catMaybes . filter wantedremote
|
||||
|
|
|
@ -22,15 +22,27 @@ import qualified Assistant.Threads.Transferrer as Transferrer
|
|||
import Logs.Transfer
|
||||
import Locations.UserConfig
|
||||
import qualified Config
|
||||
import Git.Config
|
||||
import Assistant.Threads.Watcher
|
||||
import Assistant.NamedThread
|
||||
|
||||
import qualified Data.Map as M
|
||||
import Control.Concurrent
|
||||
import System.Posix.Signals (signalProcessGroup, sigTERM, sigKILL)
|
||||
import System.Posix.Process (getProcessGroupIDOf)
|
||||
|
||||
{- Use Nothing to change global sync setting. -}
|
||||
{- Use Nothing to change autocommit setting; or a remote to change
|
||||
- its sync setting. -}
|
||||
changeSyncable :: (Maybe Remote) -> Bool -> Handler ()
|
||||
changeSyncable Nothing _ = noop -- TODO
|
||||
changeSyncable Nothing enable = liftAssistant $ do
|
||||
liftAnnex $ Config.setConfig key (boolConfig enable)
|
||||
liftIO . maybe noop (`throwTo` signal)
|
||||
=<< namedThreadId watchThread
|
||||
where
|
||||
key = Config.annexConfig "autocommit"
|
||||
signal
|
||||
| enable = ResumeWatcher
|
||||
| otherwise = PauseWatcher
|
||||
changeSyncable (Just r) True = do
|
||||
changeSyncFlag r True
|
||||
syncRemote r
|
||||
|
@ -48,13 +60,10 @@ changeSyncable (Just r) False = do
|
|||
|
||||
changeSyncFlag :: Remote -> Bool -> Handler ()
|
||||
changeSyncFlag r enabled = runAnnex undefined $ do
|
||||
Config.setConfig key value
|
||||
Config.setConfig key (boolConfig enabled)
|
||||
void $ Remote.remoteListRefresh
|
||||
where
|
||||
key = Config.remoteConfig (Remote.repo r) "sync"
|
||||
value
|
||||
| enabled = "true"
|
||||
| otherwise = "false"
|
||||
|
||||
{- Start syncing remote, using a background thread. -}
|
||||
syncRemote :: Remote -> Handler ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue