--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.
This commit is contained in:
Joey Hess 2016-07-20 15:22:55 -04:00
parent 847944e6b1
commit d13194b230
Failed to extract signature
15 changed files with 145 additions and 102 deletions

View file

@ -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