make copy --to check preferred content of the remote
This commit is contained in:
parent
17543f6e80
commit
1eedf495c3
5 changed files with 73 additions and 39 deletions
|
@ -11,6 +11,7 @@ import Common.Annex
|
|||
import Command
|
||||
import qualified Command.Move
|
||||
import qualified Remote
|
||||
import Annex.Wanted
|
||||
|
||||
def :: [Command]
|
||||
def = [withOptions Command.Move.options $ command "copy" paramPaths seek
|
||||
|
@ -21,8 +22,14 @@ seek = [withField Command.Move.toOption Remote.byName $ \to ->
|
|||
withField Command.Move.fromOption Remote.byName $ \from ->
|
||||
withFilesInGit $ whenAnnexed $ start to from]
|
||||
|
||||
-- A copy is just a move that does not delete the source file.
|
||||
-- However, --auto mode avoids unnecessary copies.
|
||||
{- A copy is just a move that does not delete the source file.
|
||||
- However, --auto mode avoids unnecessary copies, and avoids getting or
|
||||
- sending non-preferred content. -}
|
||||
start :: Maybe Remote -> Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart
|
||||
start to from file (key, backend) = autoCopies file key (<) $
|
||||
Command.Move.start to from False file (key, backend)
|
||||
stopUnless shouldCopy $
|
||||
Command.Move.start to from False file (key, backend)
|
||||
where
|
||||
shouldCopy = case to of
|
||||
Nothing -> checkAuto $ shouldGet file key
|
||||
Just r -> checkAuto $ shouldSend r file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue