aboutsummaryrefslogtreecommitdiff
path: root/Command/Drop.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-07-20 15:22:55 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-07-20 15:23:43 -0400
commit258a3356e6461e0164441bb3a3e202cb9ef889e6 (patch)
treef198f34aaedeffb1af624f918a214527b066175a /Command/Drop.hs
parente97cd57e1ac72d5a240852704ebaf92716fcad94 (diff)
--branch, stage 2
Show branch:file that is being operated on. I had to make ActionItem a type and not a type class because withKeyOptions' passed two different types of values when using the type class, and I could not get the type checker to accept that.
Diffstat (limited to 'Command/Drop.hs')
-rw-r--r--Command/Drop.hs28
1 files changed, 15 insertions, 13 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 16196f0ca..79797ab02 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -63,36 +63,38 @@ seek o = allowConcurrentOutput $
go = whenAnnexed $ start o
start :: DropOptions -> FilePath -> Key -> CommandStart
-start o file key = start' o key (Just file)
+start o file key = start' o key afile (mkActionItem afile)
+ where
+ afile = Just file
-start' :: DropOptions -> Key -> AssociatedFile -> CommandStart
-start' o key afile = do
+start' :: DropOptions -> Key -> AssociatedFile -> ActionItem -> CommandStart
+start' o key afile ai = do
from <- maybe (pure Nothing) (Just <$$> getParsed) (dropFrom o)
checkDropAuto (autoMode o) from afile key $ \numcopies ->
stopUnless (want from) $
case from of
- Nothing -> startLocal afile numcopies key []
+ Nothing -> startLocal afile ai numcopies key []
Just remote -> do
u <- getUUID
if Remote.uuid remote == u
- then startLocal afile numcopies key []
- else startRemote afile numcopies key remote
+ then startLocal afile ai numcopies key []
+ else startRemote afile ai numcopies key remote
where
want from
| autoMode o = wantDrop False (Remote.uuid <$> from) (Just key) afile
| otherwise = return True
-startKeys :: DropOptions -> Key -> CommandStart
+startKeys :: DropOptions -> Key -> ActionItem -> CommandStart
startKeys o key = start' o key Nothing
-startLocal :: AssociatedFile -> NumCopies -> Key -> [VerifiedCopy] -> CommandStart
-startLocal afile numcopies key preverified = stopUnless (inAnnex key) $ do
- showStart' "drop" key afile
+startLocal :: AssociatedFile -> ActionItem -> NumCopies -> Key -> [VerifiedCopy] -> CommandStart
+startLocal afile ai numcopies key preverified = stopUnless (inAnnex key) $ do
+ showStart' "drop" key ai
next $ performLocal key afile numcopies preverified
-startRemote :: AssociatedFile -> NumCopies -> Key -> Remote -> CommandStart
-startRemote afile numcopies key remote = do
- showStart' ("drop " ++ Remote.name remote) key afile
+startRemote :: AssociatedFile -> ActionItem -> NumCopies -> Key -> Remote -> CommandStart
+startRemote afile ai numcopies key remote = do
+ showStart' ("drop " ++ Remote.name remote) key ai
next $ performRemote key afile numcopies remote
performLocal :: Key -> AssociatedFile -> NumCopies -> [VerifiedCopy] -> CommandPerform