diff options
author | 2012-01-06 04:02:35 -0400 | |
---|---|---|
committer | 2012-01-06 04:06:13 -0400 | |
commit | df21cbfdd2b7342c206ebd4aea32d989328374dc (patch) | |
tree | 24f6624e4e4c6dc06b53735bfb52973366e7b159 /Command/Move.hs | |
parent | 0a36f92a31196451c2d838fd0ae15527e8bbce18 (diff) |
look up --to and --from remote names only once
This will speed up commands like move and drop.
Diffstat (limited to 'Command/Move.hs')
-rw-r--r-- | Command/Move.hs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Command/Move.hs b/Command/Move.hs index 66a0c1660..4978283bf 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -29,20 +29,17 @@ options :: [Option] options = [fromOption, toOption] seek :: [CommandSeek] -seek = [withField "to" id $ \to -> withField "from" id $ \from -> - withFilesInGit $ whenAnnexed $ start to from True] +seek = [withField "to" Remote.byName $ \to -> + withField "from" Remote.byName $ \from -> + withFilesInGit $ whenAnnexed $ start to from True] -start :: Maybe String -> Maybe String -> Bool -> FilePath -> (Key, Backend) -> CommandStart +start :: Maybe Remote -> Maybe Remote -> Bool -> FilePath -> (Key, Backend) -> CommandStart start to from move file (key, _) = do noAuto case (from, to) of (Nothing, Nothing) -> error "specify either --from or --to" - (Nothing, Just name) -> do - dest <- Remote.byName name - toStart dest move file key - (Just name, Nothing) -> do - src <- Remote.byName name - fromStart src move file key + (Nothing, Just dest) -> toStart dest move file key + (Just src, Nothing) -> fromStart src move file key (_ , _) -> error "only one of --from or --to can be specified" where noAuto = when move $ whenM (Annex.getState Annex.auto) $ error |