add SeekInput (not yet used)
No behavior changes (hopefully), just adding SeekInput and plumbing it through to the JSON display code for later use. Over the course of 2 grueling days. withFilesNotInGit reimplemented in terms of seekHelper should be the only possible behavior change. It seems to test as behaving the same. Note that seekHelper dummies up the SeekInput in the case where segmentPaths' gives up on sorting the expanded paths because there are too many input paths. When SeekInput later gets exposed as a json field, that will result in it being a little bit wrong in the case where 100 or more paths are passed to a git-annex command. I think this is a subtle enough problem to not matter. If it does turn out to be a problem, fixing it would require splitting up the input parameters into groups of < 100, which would make git ls-files run perhaps more than is necessary. May want to revisit this, because that fix seems fairly low-impact.
This commit is contained in:
parent
a1accac084
commit
3a05d53761
88 changed files with 561 additions and 405 deletions
|
@ -76,42 +76,42 @@ seek o = startConcurrency stages $ do
|
|||
Left ToHere -> downloadStages
|
||||
ww = WarnUnmatchLsFiles
|
||||
|
||||
start :: FromToHereOptions -> RemoveWhen -> RawFilePath -> Key -> CommandStart
|
||||
start fromto removewhen f k = start' fromto removewhen afile k ai
|
||||
start :: FromToHereOptions -> RemoveWhen -> SeekInput -> RawFilePath -> Key -> CommandStart
|
||||
start fromto removewhen si f k = start' fromto removewhen afile si k ai
|
||||
where
|
||||
afile = AssociatedFile (Just f)
|
||||
ai = mkActionItem (k, afile)
|
||||
|
||||
startKey :: FromToHereOptions -> RemoveWhen -> (Key, ActionItem) -> CommandStart
|
||||
startKey fromto removewhen =
|
||||
uncurry $ start' fromto removewhen (AssociatedFile Nothing)
|
||||
startKey :: FromToHereOptions -> RemoveWhen -> (SeekInput, Key, ActionItem) -> CommandStart
|
||||
startKey fromto removewhen (si, k, ai) =
|
||||
start' fromto removewhen (AssociatedFile Nothing) si k ai
|
||||
|
||||
start' :: FromToHereOptions -> RemoveWhen -> AssociatedFile -> Key -> ActionItem -> CommandStart
|
||||
start' fromto removewhen afile key ai =
|
||||
start' :: FromToHereOptions -> RemoveWhen -> AssociatedFile -> SeekInput -> Key -> ActionItem -> CommandStart
|
||||
start' fromto removewhen afile si key ai =
|
||||
case fromto of
|
||||
Right (FromRemote src) ->
|
||||
checkFailedTransferDirection ai Download $
|
||||
fromStart removewhen afile key ai =<< getParsed src
|
||||
fromStart removewhen afile key ai si =<< getParsed src
|
||||
Right (ToRemote dest) ->
|
||||
checkFailedTransferDirection ai Upload $
|
||||
toStart removewhen afile key ai =<< getParsed dest
|
||||
toStart removewhen afile key ai si =<< getParsed dest
|
||||
Left ToHere ->
|
||||
checkFailedTransferDirection ai Download $
|
||||
toHereStart removewhen afile key ai
|
||||
toHereStart removewhen afile key ai si
|
||||
|
||||
describeMoveAction :: RemoveWhen -> String
|
||||
describeMoveAction RemoveNever = "copy"
|
||||
describeMoveAction _ = "move"
|
||||
|
||||
toStart :: RemoveWhen -> AssociatedFile -> Key -> ActionItem -> Remote -> CommandStart
|
||||
toStart removewhen afile key ai dest = do
|
||||
toStart :: RemoveWhen -> AssociatedFile -> Key -> ActionItem -> SeekInput -> Remote -> CommandStart
|
||||
toStart removewhen afile key ai si dest = do
|
||||
u <- getUUID
|
||||
if u == Remote.uuid dest
|
||||
then stop
|
||||
else toStart' dest removewhen afile key ai
|
||||
else toStart' dest removewhen afile key ai si
|
||||
|
||||
toStart' :: Remote -> RemoveWhen -> AssociatedFile -> Key -> ActionItem -> CommandStart
|
||||
toStart' dest removewhen afile key ai = do
|
||||
toStart' :: Remote -> RemoveWhen -> AssociatedFile -> Key -> ActionItem -> SeekInput -> CommandStart
|
||||
toStart' dest removewhen afile key ai si = do
|
||||
fast <- Annex.getState Annex.fast
|
||||
if fast && removewhen == RemoveNever
|
||||
then ifM (expectedPresent dest key)
|
||||
|
@ -121,7 +121,7 @@ toStart' dest removewhen afile key ai = do
|
|||
else go False (Remote.hasKey dest key)
|
||||
where
|
||||
go fastcheck isthere =
|
||||
starting (describeMoveAction removewhen) (OnlyActionOn key ai) $
|
||||
starting (describeMoveAction removewhen) (OnlyActionOn key ai) si $
|
||||
toPerform dest removewhen key afile fastcheck =<< isthere
|
||||
|
||||
expectedPresent :: Remote -> Key -> Annex Bool
|
||||
|
@ -196,10 +196,10 @@ toPerform dest removewhen key afile fastcheck isthere =
|
|||
-- to be done except for cleaning up.
|
||||
lockfailed = next $ Command.Drop.cleanupLocal key
|
||||
|
||||
fromStart :: RemoveWhen -> AssociatedFile -> Key -> ActionItem -> Remote -> CommandStart
|
||||
fromStart removewhen afile key ai src =
|
||||
fromStart :: RemoveWhen -> AssociatedFile -> Key -> ActionItem -> SeekInput -> Remote -> CommandStart
|
||||
fromStart removewhen afile key ai si src =
|
||||
stopUnless (fromOk src key) $
|
||||
starting (describeMoveAction removewhen) (OnlyActionOn key ai) $
|
||||
starting (describeMoveAction removewhen) (OnlyActionOn key ai) si $
|
||||
fromPerform src removewhen key afile
|
||||
|
||||
fromOk :: Remote -> Key -> Annex Bool
|
||||
|
@ -252,13 +252,13 @@ fromPerform src removewhen key afile = do
|
|||
-
|
||||
- When moving, the content is removed from all the reachable remotes that
|
||||
- it can safely be removed from. -}
|
||||
toHereStart :: RemoveWhen -> AssociatedFile -> Key -> ActionItem -> CommandStart
|
||||
toHereStart removewhen afile key ai =
|
||||
toHereStart :: RemoveWhen -> AssociatedFile -> Key -> ActionItem -> SeekInput -> CommandStart
|
||||
toHereStart removewhen afile key ai si =
|
||||
startingNoMessage (OnlyActionOn key ai) $ do
|
||||
rs <- Remote.keyPossibilities key
|
||||
forM_ rs $ \r ->
|
||||
includeCommandAction $
|
||||
starting (describeMoveAction removewhen) ai $
|
||||
starting (describeMoveAction removewhen) ai si $
|
||||
fromPerform r removewhen key afile
|
||||
next $ return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue