From df21cbfdd2b7342c206ebd4aea32d989328374dc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 6 Jan 2012 04:02:35 -0400 Subject: look up --to and --from remote names only once This will speed up commands like move and drop. --- Command/Get.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Command/Get.hs') diff --git a/Command/Get.hs b/Command/Get.hs index 4a50fe3fe..1a0435c36 100644 --- a/Command/Get.hs +++ b/Command/Get.hs @@ -18,17 +18,16 @@ def = [withOptions [Command.Move.fromOption] $ command "get" paramPaths seek "make content of annexed files available"] seek :: [CommandSeek] -seek = [withField "from" id $ \from -> withNumCopies $ \n -> +seek = [withField "from" Remote.byName $ \from -> withNumCopies $ \n -> whenAnnexed $ start from n] -start :: Maybe String -> Maybe Int -> FilePath -> (Key, Backend) -> CommandStart +start :: Maybe Remote -> Maybe Int -> FilePath -> (Key, Backend) -> CommandStart start from numcopies file (key, _) = stopUnless (not <$> inAnnex key) $ autoCopies key (<) numcopies $ do case from of Nothing -> go $ perform key - Just name -> do + Just src -> do -- get --from = copy --from - src <- Remote.byName name stopUnless (Command.Move.fromOk src key) $ go $ Command.Move.fromPerform src False key where -- cgit v1.2.3