unify elipsis handling
And add a simple dots-based progress display, currently only used in v2 upgrade.
This commit is contained in:
parent
ec9e9343d9
commit
00153eed48
22 changed files with 76 additions and 62 deletions
|
@ -43,7 +43,7 @@ start s = do
|
|||
perform :: String -> FilePath -> CommandPerform
|
||||
perform url file = do
|
||||
g <- Annex.gitRepo
|
||||
showNote $ "downloading " ++ url
|
||||
showAction $ "downloading " ++ url ++ " "
|
||||
let dummykey = stubKey { keyName = url, keyBackendName = "URL" }
|
||||
let tmp = gitAnnexTmpLocation g dummykey
|
||||
liftIO $ createDirectoryIfMissing True (parentDir tmp)
|
||||
|
|
|
@ -61,7 +61,7 @@ perform key = maybe droplocal dropremote =<< Annex.getState Annex.fromremote
|
|||
where
|
||||
dropremote name = do
|
||||
r <- Remote.byName name
|
||||
showNote $ "from " ++ Remote.name r ++ "..."
|
||||
showAction $ "from " ++ Remote.name r
|
||||
next $ Command.Move.fromCleanup r True key
|
||||
droplocal = Command.Drop.perform key (Just 0) -- force drop
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ getKeyFile key file = do
|
|||
Left _ -> return False
|
||||
else return True
|
||||
docopy r continue = do
|
||||
showNote $ "from " ++ Remote.name r ++ "..."
|
||||
showAction $ "from " ++ Remote.name r
|
||||
copied <- Remote.retrieveKeyFile r key file
|
||||
if copied
|
||||
then return True
|
||||
|
|
|
@ -44,7 +44,7 @@ start = do
|
|||
|
||||
liftIO $ writeFile file (drawMap rs umap trusted)
|
||||
showLongNote $ "running: dot -Tx11 " ++ file
|
||||
showProgress
|
||||
showOutput
|
||||
r <- liftIO $ boolSystem "dot" [Param "-Tx11", File file]
|
||||
next $ next $ return r
|
||||
where
|
||||
|
@ -176,7 +176,7 @@ scan r = do
|
|||
showEndOk
|
||||
return r'
|
||||
Nothing -> do
|
||||
showProgress
|
||||
showOutput
|
||||
showEndFail
|
||||
return r
|
||||
|
||||
|
@ -224,5 +224,5 @@ tryScan r
|
|||
ok -> return ok
|
||||
|
||||
sshnote = do
|
||||
showNote "sshing..."
|
||||
showProgress
|
||||
showAction "sshing"
|
||||
showOutput
|
||||
|
|
|
@ -44,9 +44,9 @@ start move file = do
|
|||
fromStart src move file
|
||||
(_ , _) -> error "only one of --from or --to can be specified"
|
||||
|
||||
showAction :: Bool -> FilePath -> Annex ()
|
||||
showAction True file = showStart "move" file
|
||||
showAction False file = showStart "copy" file
|
||||
showMoveAction :: Bool -> FilePath -> Annex ()
|
||||
showMoveAction True file = showStart "move" file
|
||||
showMoveAction False file = showStart "copy" file
|
||||
|
||||
{- Used to log a change in a remote's having a key. The change is logged
|
||||
- in the local repo, not on the remote. The process of transferring the
|
||||
|
@ -77,7 +77,7 @@ toStart dest move file = isAnnexed file $ \(key, _) -> do
|
|||
if not ishere || u == Remote.uuid dest
|
||||
then stop -- not here, so nothing to do
|
||||
else do
|
||||
showAction move file
|
||||
showMoveAction move file
|
||||
next $ toPerform dest move key
|
||||
toPerform :: Remote.Remote Annex -> Bool -> Key -> CommandPerform
|
||||
toPerform dest move key = do
|
||||
|
@ -97,7 +97,7 @@ toPerform dest move key = do
|
|||
showNote $ show err
|
||||
stop
|
||||
Right False -> do
|
||||
showNote $ "to " ++ Remote.name dest ++ "..."
|
||||
showAction $ "to " ++ Remote.name dest
|
||||
ok <- Remote.storeKey dest key
|
||||
if ok
|
||||
then next $ toCleanup dest move key
|
||||
|
@ -127,7 +127,7 @@ fromStart src move file = isAnnexed file $ \(key, _) -> do
|
|||
if u == Remote.uuid src || not (any (== src) remotes)
|
||||
then stop
|
||||
else do
|
||||
showAction move file
|
||||
showMoveAction move file
|
||||
next $ fromPerform src move key
|
||||
fromPerform :: Remote.Remote Annex -> Bool -> Key -> CommandPerform
|
||||
fromPerform src move key = do
|
||||
|
@ -135,7 +135,7 @@ fromPerform src move key = do
|
|||
if ishere
|
||||
then next $ fromCleanup src move key
|
||||
else do
|
||||
showNote $ "from " ++ Remote.name src ++ "..."
|
||||
showAction $ "from " ++ Remote.name src
|
||||
ok <- getViaTmp key $ Remote.retrieveKeyFile src key
|
||||
if ok
|
||||
then next $ fromCleanup src move key
|
||||
|
|
|
@ -45,7 +45,7 @@ perform dest key = do
|
|||
let src = gitAnnexLocation g key
|
||||
let tmpdest = gitAnnexTmpLocation g key
|
||||
liftIO $ createDirectoryIfMissing True (parentDir tmpdest)
|
||||
showNote "copying..."
|
||||
showAction "copying"
|
||||
ok <- liftIO $ copyFile src tmpdest
|
||||
if ok
|
||||
then do
|
||||
|
|
|
@ -68,7 +68,7 @@ checkRemoteUnused name = do
|
|||
|
||||
checkRemoteUnused' :: Remote.Remote Annex -> Annex ()
|
||||
checkRemoteUnused' r = do
|
||||
showNote "checking for unused data..."
|
||||
showAction "checking for unused data"
|
||||
referenced <- getKeysReferenced
|
||||
remotehas <- filterM isthere =<< loggedKeys
|
||||
let remoteunused = remotehas `exclude` referenced
|
||||
|
@ -152,7 +152,7 @@ unusedKeys = do
|
|||
bad <- staleKeys gitAnnexBadDir
|
||||
return ([], bad, tmp)
|
||||
else do
|
||||
showNote "checking for unused data..."
|
||||
showAction "checking for unused data"
|
||||
present <- getKeysPresent
|
||||
referenced <- getKeysReferenced
|
||||
let unused = present `exclude` referenced
|
||||
|
|
|
@ -35,7 +35,7 @@ perform key = do
|
|||
else do
|
||||
pp <- prettyPrintUUIDs uuids
|
||||
showLongNote pp
|
||||
showProgress
|
||||
showOutput
|
||||
next $ return True
|
||||
where
|
||||
copiesplural 1 = "copy"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue