get --from is the same as copy --from

get not honoring --from has surprised me a few times, so least surprise
suggests it should just behave like copy --from. This leaves the difference
between get and copy being that copy always requires the remote to copy
from, while get will decide whether to get a file from a key/value store or
a remote.
This commit is contained in:
Joey Hess 2011-06-09 18:54:49 -04:00
parent 2136534be1
commit 90dd245522
8 changed files with 17 additions and 9 deletions

View file

@ -9,9 +9,12 @@ module Command.Get where
import Command
import qualified Backend
import qualified Annex
import qualified Remote
import Types
import Content
import Messages
import qualified Command.Move
command :: [Command]
command = [repoCommand "get" paramPath seek
@ -20,7 +23,6 @@ command = [repoCommand "get" paramPath seek
seek :: [CommandSeek]
seek = [withFilesInGit start]
{- Gets an annexed file from one of the backends. -}
start :: CommandStartString
start file = isAnnexed file $ \(key, backend) -> do
inannex <- inAnnex key
@ -28,7 +30,12 @@ start file = isAnnexed file $ \(key, backend) -> do
then stop
else do
showStart "get" file
next $ perform key backend
from <- Annex.getState Annex.fromremote
case from of
Nothing -> next $ perform key backend
Just name -> do
src <- Remote.byName name
next $ Command.Move.fromPerform src False key
perform :: Key -> Backend Annex -> CommandPerform
perform key backend = do