look up --to and --from remote names only once
This will speed up commands like move and drop.
This commit is contained in:
parent
0a36f92a31
commit
df21cbfdd2
10 changed files with 30 additions and 33 deletions
|
@ -10,17 +10,19 @@ module Command.Copy where
|
|||
import Common.Annex
|
||||
import Command
|
||||
import qualified Command.Move
|
||||
import qualified Remote
|
||||
|
||||
def :: [Command]
|
||||
def = [withOptions Command.Move.options $ command "copy" paramPaths seek
|
||||
"copy content of files to/from another repository"]
|
||||
|
||||
seek :: [CommandSeek]
|
||||
seek = [withField "to" id $ \to -> withField "from" id $ \from ->
|
||||
withNumCopies $ \n -> whenAnnexed $ start to from n]
|
||||
seek = [withField "to" Remote.byName $ \to ->
|
||||
withField "from" Remote.byName $ \from ->
|
||||
withNumCopies $ \n -> whenAnnexed $ start to from n]
|
||||
|
||||
-- A copy is just a move that does not delete the source file.
|
||||
-- However, --auto mode avoids unnecessary copies.
|
||||
start :: Maybe String -> Maybe String -> Maybe Int -> FilePath -> (Key, Backend) -> CommandStart
|
||||
start :: Maybe Remote -> Maybe Remote -> Maybe Int -> FilePath -> (Key, Backend) -> CommandStart
|
||||
start to from numcopies file (key, backend) = autoCopies key (<) numcopies $
|
||||
Command.Move.start to from False file (key, backend)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue