This commit is contained in:
Joey Hess 2014-01-26 15:53:01 -04:00
parent 4d0223e962
commit 3149a62a35
6 changed files with 13 additions and 16 deletions

View file

@ -18,7 +18,6 @@ import Config.NumCopies
import Annex.Content
import qualified Option
import Annex.Wanted
import Types.Key
def :: [Command]
def = [withOptions [fromOption] $ command "drop" paramPaths seek
@ -45,12 +44,12 @@ start from file (key, _) = checkDropAuto from file key $ \numcopies ->
startLocal :: AssociatedFile -> NumCopies -> Key -> Maybe Remote -> CommandStart
startLocal afile numcopies key knownpresentremote = stopUnless (inAnnex key) $ do
showStart "drop" (fromMaybe (key2file key) afile)
showStart' "drop" key afile
next $ performLocal key numcopies knownpresentremote
startRemote :: AssociatedFile -> NumCopies -> Key -> Remote -> CommandStart
startRemote afile numcopies key remote = do
showStart ("drop " ++ Remote.name remote) (fromMaybe (key2file key) afile)
showStart' ("drop " ++ Remote.name remote) key afile
next $ performRemote key numcopies remote
performLocal :: Key -> NumCopies -> Maybe Remote -> CommandPerform

View file

@ -12,7 +12,6 @@ import Command
import qualified Annex
import Logs.Location
import Annex.Content
import Types.Key
def :: [Command]
def = [noCommit $ command "dropkey" (paramRepeating paramKey) seek
@ -25,7 +24,7 @@ start :: Key -> CommandStart
start key = stopUnless (inAnnex key) $ do
unlessM (Annex.getState Annex.force) $
error "dropkey can cause data loss; use --force if you're sure you want to do this"
showStart "dropkey" (key2file key)
showStart' "dropkey" key Nothing
next $ perform key
perform :: Key -> CommandPerform

View file

@ -16,7 +16,6 @@ import Config.NumCopies
import Annex.Wanted
import GitAnnex.Options
import qualified Command.Move
import Types.Key
def :: [Command]
def = [withOptions getOptions $ command "get" paramPaths seek
@ -51,7 +50,7 @@ start' expensivecheck from key afile = stopUnless (not <$> inAnnex key) $
go $ Command.Move.fromPerform src False key afile
where
go a = do
showStart "get" (fromMaybe (key2file key) afile)
showStart' "get" key afile
next a
perform :: Key -> AssociatedFile -> CommandPerform

View file

@ -17,7 +17,6 @@ import Annex.UUID
import Logs.Presence
import Logs.Transfer
import GitAnnex.Options
import Types.Key
def :: [Command]
def = [withOptions moveOptions $ command "move" paramPaths seek
@ -54,10 +53,7 @@ start' to from move afile key = do
"--auto is not supported for move"
showMoveAction :: Bool -> Key -> AssociatedFile -> Annex ()
showMoveAction True _ (Just file) = showStart "move" file
showMoveAction False _ (Just file) = showStart "copy" file
showMoveAction True key Nothing = showStart "move" (key2file key)
showMoveAction False key Nothing = showStart "copy" (key2file key)
showMoveAction move = showStart' (if move then "move" else "copy")
{- Moves (or copies) the content of an annexed file to a remote.
-

View file

@ -14,7 +14,6 @@ import Command
import Remote
import Logs.Trust
import GitAnnex.Options
import Types.Key
def :: [Command]
def = [noCommit $ withOptions (jsonOption : keyOptions) $
@ -37,7 +36,7 @@ startKeys remotemap key = start' remotemap key Nothing
start' :: M.Map UUID Remote -> Key -> AssociatedFile -> CommandStart
start' remotemap key afile = do
showStart "whereis" (fromMaybe (key2file key) afile)
showStart' "whereis" key afile
next $ perform remotemap key
perform :: M.Map UUID Remote -> Key -> CommandPerform

View file

@ -1,12 +1,13 @@
{- git-annex output messages
-
- Copyright 2010-2011 Joey Hess <joey@kitenet.net>
- Copyright 2010-2014 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Messages (
showStart,
showStart',
showNote,
showAction,
showProgress,
@ -54,10 +55,14 @@ import Types.Key
import qualified Annex
import Utility.Metered
showStart :: String -> String -> Annex ()
showStart :: String -> FilePath -> Annex ()
showStart command file = handle (JSON.start command $ Just file) $
flushed $ putStr $ command ++ " " ++ file ++ " "
showStart' :: String -> Key -> Maybe FilePath -> Annex ()
showStart' command key afile = showStart command $
fromMaybe (key2file key) afile
showNote :: String -> Annex ()
showNote s = handle (JSON.note s) $
flushed $ putStr $ "(" ++ s ++ ") "