generalized Annex.Wanted

this should make it easy to use from inside the assistant, where
everything is an AssociatedFile.
This commit is contained in:
Joey Hess 2012-10-08 17:14:01 -04:00
parent acb8721072
commit fee40dd374
5 changed files with 28 additions and 33 deletions

View file

@ -31,5 +31,5 @@ start to from file (key, backend) = autoCopies file key (<) $
Command.Move.start to from False file (key, backend)
where
shouldCopy = case to of
Nothing -> checkAuto $ shouldGet file key
Just r -> checkAuto $ shouldSend r file
Nothing -> checkAuto $ wantGet (Just file)
Just r -> checkAuto $ wantSend (Remote.uuid r) (Just file)

View file

@ -32,7 +32,7 @@ seek = [withField fromOption Remote.byName $ \from ->
start :: Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart
start from file (key, _) = autoCopiesWith file key (>) $ \numcopies ->
stopUnless (checkAuto $ shouldDrop from file) $
stopUnless (checkAuto $ wantDrop (Remote.uuid <$> from) (Just file)) $
case from of
Nothing -> startLocal file numcopies key
Just remote -> do

View file

@ -24,7 +24,7 @@ seek = [withField Command.Move.fromOption Remote.byName $ \from ->
withFilesInGit $ whenAnnexed $ start from]
start :: Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart
start from file (key, _) = stopUnless (checkAuto $ shouldGet file key) $
start from file (key, _) = stopUnless ((not <$> inAnnex key) <&&> checkAuto (wantGet $ Just file)) $
autoCopies file key (<) $
case from of
Nothing -> go $ perform key file