summaryrefslogtreecommitdiff
path: root/Command/Move.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-28 17:26:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-28 17:26:38 -0400
commit6c31e3a8c3c5ab92ca2e84b4c166f32d02a50f4f (patch)
tree8f0b857728feca852c7907c2dcb552ff87e8c582 /Command/Move.hs
parent33e18d3d02865ac0677fc1f22de2352b92f184a8 (diff)
drop --from is now supported to remove file content from a remote.
Diffstat (limited to 'Command/Move.hs')
-rw-r--r--Command/Move.hs25
1 files changed, 3 insertions, 22 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index ae5e0e1d4..2a7402a0d 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -11,7 +11,6 @@ import Common.Annex
import Command
import qualified Command.Drop
import qualified Annex
-import Logs.Location
import Annex.Content
import qualified Remote
import Annex.UUID
@@ -49,18 +48,6 @@ 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
- - key to the remote, or removing the key from it *may* log the change
- - on the remote, but this cannot be relied on. -}
-remoteHasKey :: Remote.Remote Annex -> Key -> Bool -> Annex ()
-remoteHasKey remote key present = do
- let remoteuuid = Remote.uuid remote
- g <- gitRepo
- logChange g key remoteuuid status
- where
- status = if present then InfoPresent else InfoMissing
-
{- Moves (or copies) the content of an annexed file to a remote.
-
- If the remote already has the content, it is still removed from
@@ -108,9 +95,9 @@ toPerform dest move key = do
Right True -> next $ toCleanup dest move key
toCleanup :: Remote.Remote Annex -> Bool -> Key -> CommandCleanup
toCleanup dest move key = do
- remoteHasKey dest key True
+ Remote.remoteHasKey dest key True
if move
- then Command.Drop.cleanup key
+ then Command.Drop.cleanupLocal key
else return True
{- Moves (or copies) the content of an annexed file from a remote
@@ -140,11 +127,5 @@ fromPerform src move key = do
then next $ fromCleanup src move key
else stop -- fail
fromCleanup :: Remote.Remote Annex -> Bool -> Key -> CommandCleanup
-fromCleanup src True key = do
- ok <- Remote.removeKey src key
- -- better safe than sorry: assume the src dropped the key
- -- even if it seemed to fail; the failure could have occurred
- -- after it really dropped it
- remoteHasKey src key False
- return ok
+fromCleanup src True key = Command.Drop.cleanupRemote key src
fromCleanup _ False _ = return True