diff options
-rw-r--r-- | Command.hs | 7 | ||||
-rw-r--r-- | Command/DropKey.hs | 14 | ||||
-rw-r--r-- | Command/InAnnex.hs | 13 | ||||
-rw-r--r-- | Command/RecvKey.hs | 11 | ||||
-rw-r--r-- | Command/SendKey.hs | 11 | ||||
-rw-r--r-- | doc/git-annex.mdwn | 2 |
6 files changed, 17 insertions, 41 deletions
diff --git a/Command.hs b/Command.hs index 27598fff0..c3cb612ee 100644 --- a/Command.hs +++ b/Command.hs @@ -14,6 +14,7 @@ import Control.Monad (filterM, liftM, when) import System.Path.WildMatch import Text.Regex.PCRE.Light.Char8 import Data.List +import Data.Maybe import Types import qualified Backend @@ -46,6 +47,8 @@ type CommandCleanup = Annex Bool - functions. -} type CommandSeekStrings = CommandStartString -> CommandSeek type CommandStartString = String -> CommandStart +type CommandSeekKeys = CommandStartKey -> CommandSeek +type CommandStartKey = Key -> CommandStart type BackendFile = (FilePath, Maybe (Backend Annex)) type CommandSeekBackendFiles = CommandStartBackendFile -> CommandSeek type CommandStartBackendFile = BackendFile -> CommandStart @@ -167,8 +170,8 @@ withFilesUnlocked' typechanged a params = do map (\f -> Git.workTree repo ++ "/" ++ f) typechangedfiles unlockedfiles' <- filterFiles unlockedfiles backendPairs a unlockedfiles' -withKeys :: CommandSeekStrings -withKeys a params = return $ map a params +withKeys :: CommandSeekKeys +withKeys a params = return $ map a $ catMaybes $ map readKey params withTempFile :: CommandSeekStrings withTempFile a params = return $ map a params withNothing :: CommandSeekNothing diff --git a/Command/DropKey.hs b/Command/DropKey.hs index f0450eea3..419d9caa4 100644 --- a/Command/DropKey.hs +++ b/Command/DropKey.hs @@ -14,6 +14,7 @@ import LocationLog import Types import Content import Messages +import Key command :: [Command] command = [Command "dropkey" (paramRepeating paramKey) seek @@ -22,21 +23,16 @@ command = [Command "dropkey" (paramRepeating paramKey) seek seek :: [CommandSeek] seek = [withKeys start] -{- Drops cached content for a key. -} -start :: CommandStartString -start keyname = do - backends <- Backend.list - let key = error "fixme!!" - --let key = genKey (head backends) keyname --TODO FIXME - let present = error "fixme!!" - --present <- inAnnex key +start :: CommandStartKey +start key = do + present <- inAnnex key force <- Annex.getState Annex.force if not present then return Nothing else if not force then error "dropkey is can cause data loss; use --force if you're sure you want to do this" else do - showStart "dropkey" keyname + showStart "dropkey" (show key) return $ Just $ perform key perform :: Key -> CommandPerform diff --git a/Command/InAnnex.hs b/Command/InAnnex.hs index a2beda4a5..fa81fc9a4 100644 --- a/Command/InAnnex.hs +++ b/Command/InAnnex.hs @@ -12,9 +12,6 @@ import System.Exit import Command import Content -import qualified Backend -import qualified BackendClass -import Key command :: [Command] command = [Command "inannex" (paramRepeating paramKey) seek @@ -23,14 +20,8 @@ command = [Command "inannex" (paramRepeating paramKey) seek seek :: [CommandSeek] seek = [withKeys start] -start :: CommandStartString -start keyname = do - backends <- Backend.list - let key = stubKey { - keyName = keyname, - keyBackendName = BackendClass.name (head backends) - } - error "BROKEN. fixme!" +start :: CommandStartKey +start key = do present <- inAnnex key if present then return Nothing diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs index 488bab62d..c7c37d1e3 100644 --- a/Command/RecvKey.hs +++ b/Command/RecvKey.hs @@ -12,10 +12,8 @@ import Control.Monad.State (liftIO) import System.Exit import Command -import Types import CmdLine import Content -import qualified Backend import RsyncFile command :: [Command] @@ -25,12 +23,8 @@ command = [Command "recvkey" paramKey seek seek :: [CommandSeek] seek = [withKeys start] -start :: CommandStartString -start keyname = do - error "BROKEN FIXME!" - {- - backends <- Backend.list - let key = genKey (head backends) keyname +start :: CommandStartKey +start key = do present <- inAnnex key when present $ error "key is already present in annex" @@ -43,4 +37,3 @@ start keyname = do _ <- shutdown liftIO exitSuccess else liftIO exitFailure - -} diff --git a/Command/SendKey.hs b/Command/SendKey.hs index ff269f21f..56974bda9 100644 --- a/Command/SendKey.hs +++ b/Command/SendKey.hs @@ -14,9 +14,7 @@ import System.Exit import Locations import qualified Annex import Command -import Types import Content -import qualified Backend import RsyncFile command :: [Command] @@ -26,16 +24,11 @@ command = [Command "sendkey" paramKey seek seek :: [CommandSeek] seek = [withKeys start] -start :: CommandStartString -start keyname = do - error "BROKEN FIXME!" - {- - backends <- Backend.list - let key = genKey (head backends) keyname +start :: CommandStartKey +start key = do present <- inAnnex key g <- Annex.gitRepo let file = gitAnnexLocation g key when present $ liftIO $ rsyncServerSend file liftIO exitFailure - -} diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index f2ec5fd15..bfec527d9 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -250,7 +250,7 @@ Many git-annex commands will stage changes for later `git commit` by you. Example: - git annex dropkey --key=SHA1-s10-7da006579dd64330eb2456001fd01948430572f2 + git annex dropkey SHA1-s10-7da006579dd64330eb2456001fd01948430572f2 * setkey file |