added progress bars

clean up old todo item I checked earlier, see commit
dec30d2b14
This commit is contained in:
Joey Hess 2019-03-08 12:43:03 -04:00
parent e412129523
commit 6149a3b9bd
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 16 additions and 21 deletions

View file

@ -35,7 +35,7 @@ import Backend
import Config import Config
import Types.Key import Types.Key
import Types.KeySource import Types.KeySource
import Utility.Metered import Messages.Progress
import Utility.DataUnits import Utility.DataUnits
import Logs.Export import Logs.Export
import Logs.Location import Logs.Location
@ -255,7 +255,7 @@ downloadImport remote importtreeconfig importablecontents = do
(k:_) -> return $ Left $ Just (loc, k) (k:_) -> return $ Left $ Just (loc, k)
[] -> do [] -> do
job <- liftIO $ newEmptyTMVarIO job <- liftIO $ newEmptyTMVarIO
let rundownload = do let downloadaction = do
showStart "import" (fromImportLocation loc) showStart "import" (fromImportLocation loc)
next $ tryNonAsync (download cidmap db i) >>= \case next $ tryNonAsync (download cidmap db i) >>= \case
Left e -> next $ do Left e -> next $ do
@ -270,24 +270,25 @@ downloadImport remote importtreeconfig importablecontents = do
commandAction $ bracket_ commandAction $ bracket_
(waitstart downloading cid) (waitstart downloading cid)
(signaldone downloading cid) (signaldone downloading cid)
rundownload downloadaction
return (Right job) return (Right job)
download cidmap db (loc, (cid, sz)) = download cidmap db (loc, (cid, sz)) = do
let rundownload tmpfile p =
Remote.retrieveExportWithContentIdentifier ia loc cid tmpfile (mkkey loc tmpfile) p >>= \case
Just k -> tryNonAsync (moveAnnex k tmpfile) >>= \case
Right True -> do
recordcidkey cidmap db cid k
logStatus k InfoPresent
logChange k (Remote.uuid remote) InfoPresent
return $ Just (loc, k)
_ -> return Nothing
Nothing -> return Nothing
checkDiskSpaceToGet tmpkey Nothing $ checkDiskSpaceToGet tmpkey Nothing $
withTmp tmpkey $ \tmpfile -> withTmp tmpkey $ \tmpfile ->
Remote.retrieveExportWithContentIdentifier ia loc cid tmpfile (mkkey loc tmpfile) p >>= \case metered Nothing tmpkey (return Nothing) $
Just k -> tryNonAsync (moveAnnex k tmpfile) >>= \case const (rundownload tmpfile)
Right True -> do
recordcidkey cidmap db cid k
logStatus k InfoPresent
logChange k (Remote.uuid remote) InfoPresent
return $ Just (loc, k)
_ -> return Nothing
Nothing -> return Nothing
where where
-- TODO progress bar
p = nullMeterUpdate
ia = Remote.importActions remote ia = Remote.importActions remote
tmpkey = importKey cid sz tmpkey = importKey cid sz

View file

@ -13,8 +13,6 @@ this.
* Need to support annex-tracking-branch configuration, which documentation * Need to support annex-tracking-branch configuration, which documentation
says makes git-annex sync and assistant do imports. says makes git-annex sync and assistant do imports.
* progress bars when downloading from import
* When on an adjusted unlocked branch, need to import the files unlocked. * When on an adjusted unlocked branch, need to import the files unlocked.
Also, the tracking branch code needs to know about such branches, Also, the tracking branch code needs to know about such branches,
currently it will generate the wrong tracking branch. currently it will generate the wrong tracking branch.
@ -30,10 +28,6 @@ this.
(like eg a way to merge a specified branch and update the adjustment) (like eg a way to merge a specified branch and update the adjustment)
would thus benefit both uses cases. would thus benefit both uses cases.
* What if the remote lists importable filenames that are absolute paths,
or contain a "../" attack? Does git already guard against merging such
trees?
* Need to support annex.largefiles when importing. * Need to support annex.largefiles when importing.
* If a tree containing a non-annexed file is exported, * If a tree containing a non-annexed file is exported,