--auto fixes

* get/copy --auto: Transfer data even if it would exceed numcopies,
  when preferred content settings want it.
* drop --auto: Fix dropping content when there are no preferred content
  settings.
This commit is contained in:
Joey Hess 2012-12-06 13:22:16 -04:00
parent 28cfd6776d
commit 99a8a5297c
12 changed files with 50 additions and 48 deletions

View file

@ -26,10 +26,11 @@ seek = [withField Command.Move.toOption Remote.byName $ \to ->
- However, --auto mode avoids unnecessary copies, and avoids getting or
- sending non-preferred content. -}
start :: Maybe Remote -> Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart
start to from file (key, backend) = autoCopies file key (<) $
stopUnless shouldCopy $
Command.Move.start to from False file (key, backend)
start to from file (key, backend) = stopUnless shouldCopy $
Command.Move.start to from False file (key, backend)
where
shouldCopy = case to of
Nothing -> checkAuto $ wantGet (Just file)
Just r -> checkAuto $ wantSend (Just file) (Remote.uuid r)
shouldCopy = checkAuto (check <||> numCopiesCheck file key (<))
check = case to of
Nothing -> wantGet False (Just file)
Just r -> wantSend False (Just file) (Remote.uuid r)