safer inannex checking

git-annex-shell inannex now returns always 0, 1, or 100 (the last when
it's unclear if content is currently in the index due to it currently being
moved or dropped).

(Actual locking code still not yet written.)
This commit is contained in:
Joey Hess 2011-11-09 18:33:15 -04:00
parent 2934a65ac5
commit d3e1a3619f
14 changed files with 93 additions and 50 deletions

View file

@ -82,7 +82,7 @@ toPerform dest move key = moveLock move key $ do
else Remote.hasKey dest key
case isthere of
Left err -> do
showNote $ show err
showNote $ err
stop
Right False -> do
showAction $ "to " ++ Remote.name dest
@ -96,7 +96,7 @@ toPerform dest move key = moveLock move key $ do
Right True -> finish
where
finish = do
Remote.remoteHasKey dest key True
Remote.logStatus dest key True
if move
then do
whenM (inAnnex key) $ removeAnnex key
@ -137,5 +137,5 @@ fromPerform src move key = moveLock move key $ do
{- Locks a key in order for it to be moved.
- No lock is needed when a key is being copied. -}
moveLock :: Bool -> Key -> Annex a -> Annex a
moveLock True key a = lockExclusive key a
moveLock True key a = lockContent key a
moveLock False _ a = a