fixed dropkey, setkey, and git-annex-shell subcommands
key is now specified as the full key, no --backend needed
This commit is contained in:
parent
da504f647f
commit
2e1cc2f8b9
6 changed files with 17 additions and 41 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
-}
|
||||
|
|
|
@ -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
|
||||
-}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue