add error for move --auto

It probably does not make sense to enable auto mode for move. I cannot
think of a situation where it would make sense to try to use it.

A hypothetical auto mode for move would only differ from a normal
move in one case -- when both repositories have a file, move deletes it
from one, and this reduces the number of copies. So an auto mode would
either only let move work in that situation, or avoid removing the file
in that situation, depending on the number of copies. This would be
complex to implement, and is perhaps not a very obvious behavior.

The error is a good thing to have, so users don't expect it to do something
it does not.
This commit is contained in:
Joey Hess 2011-09-15 15:33:20 -04:00
parent a0d3a343b5
commit e47d1fd43e

View file

@ -18,6 +18,7 @@ import Content
import qualified Remote
import UUID
import Messages
import Utility.Conditional
command :: [Command]
command = [repoCommand "move" paramPaths seek
@ -32,6 +33,7 @@ seek = [withFilesInGit $ start True]
- moving data in the key-value backend. -}
start :: Bool -> CommandStartString
start move file = do
noAuto
to <- Annex.getState Annex.toremote
from <- Annex.getState Annex.fromremote
case (from, to) of
@ -43,6 +45,9 @@ start move file = do
src <- Remote.byName name
fromStart src move file
(_ , _) -> error "only one of --from or --to can be specified"
where
noAuto = when move $ whenM (Annex.getState Annex.auto) $ error
"--auto is not supported for move"
showMoveAction :: Bool -> FilePath -> Annex ()
showMoveAction True file = showStart "move" file