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

@ -81,7 +81,7 @@ copyKeyFile key file = do
Left _ -> return False
else return True
docopy r continue = do
showNote $ "copying from " ++ Remote.name r ++ "..."
showNote $ "from " ++ Remote.name r ++ "..."
copied <- Remote.retrieveKeyFile r key file
if copied
then return True

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

1
debian/changelog vendored
View file

@ -2,6 +2,7 @@ git-annex (0.20110602) UNRELEASED; urgency=low
* Add --numcopies option.
* Add --trust, --untrust, and --semitrust options.
* get --from is the same as copy --from
-- Joey Hess <joeyh@debian.org> Wed, 01 Jun 2011 16:26:48 -0400

View file

@ -30,7 +30,7 @@ The newline is in the wrong place and confuses the user. It should be printed _a
> A related problem occurs if an error message is unexpetedly printed.
> Dummying up an example:
>
> O get test1 (copying from foo...) E git-annex: failed to run ssh
> O get test1 (from foo...) E git-annex: failed to run ssh
> failed
>
> --[[Joey]]

View file

@ -41,7 +41,7 @@ content from the key-value store.
# sudo mount /media/usb
# git remote add usbdrive /media/usb
# git annex get video/hackity_hack_and_kaxxt.mov
get video/hackity_hack_and_kaxxt.mov (copying from usbdrive...) ok
get video/hackity_hack_and_kaxxt.mov (from usbdrive...) ok
# git commit -a -m "got a video I want to rewatch on the plane"
# git annex add iso

View file

@ -8,8 +8,8 @@ USB drive.
# cd /media/usb/annex
# git pull laptop master
# git annex get .
get my_cool_big_file (copying from laptop...) ok
get iso/debian.iso (copying from laptop...) ok
get my_cool_big_file (from laptop...) ok
get iso/debian.iso (from laptop...) ok
Notice that you had to git pull from laptop first, this lets git-annex know
what has changed in laptop, and so it knows about the files present there and

View file

@ -14,5 +14,5 @@ it:
failed
# sudo mount /media/usb
# git annex get video/hackity_hack_and_kaxxt.mov
get video/hackity_hack_and_kaxxt.mov (copying from usbdrive...) ok
get video/hackity_hack_and_kaxxt.mov (from usbdrive...) ok
# git commit -a -m "got a video I want to rewatch on the plane"

View file

@ -12,7 +12,7 @@ to clone the laptop's annex to it:
Now you can get files and they will be transferred (using `rsync` via `ssh`):
# git annex get my_cool_big_file
get my_cool_big_file (getting UUID for origin...) (copying from origin...)
get my_cool_big_file (getting UUID for origin...) (from origin...)
WORM-s2159-m1285650548--my_cool_big_file 100% 2159 2.1KB/s 00:00
ok