switch code to using associated files
This commit is contained in:
parent
32adb5f0e0
commit
99a1113461
1 changed files with 10 additions and 10 deletions
|
@ -375,11 +375,11 @@ seekSyncContent rs = do
|
||||||
liftIO $ not <$> isEmptyMVar mvar
|
liftIO $ not <$> isEmptyMVar mvar
|
||||||
where
|
where
|
||||||
go mvar f = ifAnnexed f
|
go mvar f = ifAnnexed f
|
||||||
(\v -> void (liftIO (tryPutMVar mvar ())) >> syncFile rs f v)
|
(\v -> void (liftIO (tryPutMVar mvar ())) >> syncFile rs (Just f) v)
|
||||||
noop
|
noop
|
||||||
|
|
||||||
syncFile :: [Remote] -> FilePath -> Key -> Annex ()
|
syncFile :: [Remote] -> AssociatedFile -> Key -> Annex ()
|
||||||
syncFile rs f k = do
|
syncFile rs af k = do
|
||||||
locs <- loggedLocations k
|
locs <- loggedLocations k
|
||||||
let (have, lack) = partition (\r -> Remote.uuid r `elem` locs) rs
|
let (have, lack) = partition (\r -> Remote.uuid r `elem` locs) rs
|
||||||
|
|
||||||
|
@ -391,31 +391,31 @@ syncFile rs f k = do
|
||||||
|
|
||||||
-- Using callCommandAction rather than includeCommandAction for drops,
|
-- Using callCommandAction rather than includeCommandAction for drops,
|
||||||
-- because a failure to drop does not mean the sync failed.
|
-- because a failure to drop does not mean the sync failed.
|
||||||
handleDropsFrom locs' rs "unwanted" True k (Just f)
|
handleDropsFrom locs' rs "unwanted" True k af
|
||||||
Nothing callCommandAction
|
Nothing callCommandAction
|
||||||
where
|
where
|
||||||
wantget have = allM id
|
wantget have = allM id
|
||||||
[ pure (not $ null have)
|
[ pure (not $ null have)
|
||||||
, not <$> inAnnex k
|
, not <$> inAnnex k
|
||||||
, wantGet True (Just k) (Just f)
|
, wantGet True (Just k) af
|
||||||
]
|
]
|
||||||
handleget have = ifM (wantget have)
|
handleget have = ifM (wantget have)
|
||||||
( return [ get have ]
|
( return [ get have ]
|
||||||
, return []
|
, return []
|
||||||
)
|
)
|
||||||
get have = includeCommandAction $ do
|
get have = includeCommandAction $ do
|
||||||
showStart "get" f
|
showStart' "get" k af
|
||||||
next $ next $ getViaTmp k $ \dest -> getKeyFile' k (Just f) dest have
|
next $ next $ getViaTmp k $ \dest -> getKeyFile' k af dest have
|
||||||
|
|
||||||
wantput r
|
wantput r
|
||||||
| Remote.readonly r || remoteAnnexReadOnly (Remote.gitconfig r) = return False
|
| Remote.readonly r || remoteAnnexReadOnly (Remote.gitconfig r) = return False
|
||||||
| otherwise = wantSend True (Just k) (Just f) (Remote.uuid r)
|
| otherwise = wantSend True (Just k) af (Remote.uuid r)
|
||||||
handleput lack = ifM (inAnnex k)
|
handleput lack = ifM (inAnnex k)
|
||||||
( map put <$> filterM wantput lack
|
( map put <$> filterM wantput lack
|
||||||
, return []
|
, return []
|
||||||
)
|
)
|
||||||
put dest = do
|
put dest = do
|
||||||
ok <- includeCommandAction $ do
|
ok <- includeCommandAction $ do
|
||||||
showStart "copy" f
|
showStart' "copy" k af
|
||||||
Command.Move.toStart' dest False (Just f) k
|
Command.Move.toStart' dest False af k
|
||||||
return (ok, if ok then Just (Remote.uuid dest) else Nothing)
|
return (ok, if ok then Just (Remote.uuid dest) else Nothing)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue