much better command action handling for sync --content

This commit is contained in:
Joey Hess 2014-01-20 13:31:03 -04:00
parent cfa6865056
commit 73c420ffcf
5 changed files with 68 additions and 61 deletions

View file

@ -14,6 +14,7 @@ import Assistant.Common
import Assistant.DaemonStatus
import Annex.Drop (handleDropsFrom, Reason)
import Logs.Location
import RunCommand
{- Drop from local and/or remote when allowed by the preferred content and
- numcopies settings. -}
@ -22,4 +23,4 @@ handleDrops _ _ _ Nothing _ = noop
handleDrops reason fromhere key f knownpresentremote = do
syncrs <- syncDataRemotes <$> getDaemonStatus
locs <- liftAnnex $ loggedLocations key
liftAnnex $ handleDropsFrom locs syncrs reason fromhere key f knownpresentremote
liftAnnex $ handleDropsFrom locs syncrs reason fromhere key f knownpresentremote callCommand

View file

@ -29,6 +29,7 @@ import qualified Git.LsFiles as LsFiles
import qualified Backend
import Annex.Content
import Annex.Wanted
import RunCommand
import qualified Data.Set as S
@ -158,7 +159,7 @@ expensiveScan urlrenderer rs = unless onlyweb $ batch <~> do
present <- liftAnnex $ inAnnex key
liftAnnex $ handleDropsFrom locs syncrs
"expensive scan found too many copies of object"
present key (Just f) Nothing
present key (Just f) Nothing callCommand
liftAnnex $ do
let slocs = S.fromList locs
let use a = return $ mapMaybe (a key slocs) syncrs