incomplete action to download files from import

This commit is contained in:
Joey Hess 2019-02-26 15:25:28 -04:00
parent b6e2a5e9c2
commit f4b773e9a1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 100 additions and 13 deletions

View file

@ -253,11 +253,7 @@ seekRemote remote branch msubdir = allowConcurrentOutput $ do
parentcommit <- frombranch Git.Ref.sha
let importcommitconfig = ImportCommitConfig parentcommit ManualCommit importmessage
showStart' "import" (Just (Remote.name remote))
-- TODO enumerate and download
let importable = ImportableContents [] []
showEndOk
importable <- download =<< enumerate
void $ includeCommandAction $
commitRemote remote branch tb parentcommit importtreeconfig importcommitconfig importable
where
@ -269,6 +265,20 @@ seekRemote remote branch msubdir = allowConcurrentOutput $ do
Just v -> return (Just v)
Nothing -> inRepo (a branch)
enumerate = do
showStart' "import" (Just (Remote.name remote))
Remote.listImportableContents (Remote.importActions remote) >>= \case
Nothing -> do
showEndFail
giveup $ "Unable to list contents of " ++ Remote.name remote
Just importable -> do
showEndOk
return importable
download importablecontents = downloadImport remote importablecontents >>= \case
Nothing -> giveup $ "Failed to import some files from " ++ Remote.name remote ++ ". Re-run command to resume import."
Just importable -> return importable
commitRemote :: Remote -> Branch -> RemoteTrackingBranch -> Maybe Sha -> ImportTreeConfig -> ImportCommitConfig -> ImportableContents Key -> CommandStart
commitRemote remote branch tb parentcommit importtreeconfig importcommitconfig importable = do
showStart' "update" (Just $ fromRef $ fromRemoteTrackingBranch tb)