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 System.Path.WildMatch
|
||||||
import Text.Regex.PCRE.Light.Char8
|
import Text.Regex.PCRE.Light.Char8
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import Data.Maybe
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
import qualified Backend
|
import qualified Backend
|
||||||
|
@ -46,6 +47,8 @@ type CommandCleanup = Annex Bool
|
||||||
- functions. -}
|
- functions. -}
|
||||||
type CommandSeekStrings = CommandStartString -> CommandSeek
|
type CommandSeekStrings = CommandStartString -> CommandSeek
|
||||||
type CommandStartString = String -> CommandStart
|
type CommandStartString = String -> CommandStart
|
||||||
|
type CommandSeekKeys = CommandStartKey -> CommandSeek
|
||||||
|
type CommandStartKey = Key -> CommandStart
|
||||||
type BackendFile = (FilePath, Maybe (Backend Annex))
|
type BackendFile = (FilePath, Maybe (Backend Annex))
|
||||||
type CommandSeekBackendFiles = CommandStartBackendFile -> CommandSeek
|
type CommandSeekBackendFiles = CommandStartBackendFile -> CommandSeek
|
||||||
type CommandStartBackendFile = BackendFile -> CommandStart
|
type CommandStartBackendFile = BackendFile -> CommandStart
|
||||||
|
@ -167,8 +170,8 @@ withFilesUnlocked' typechanged a params = do
|
||||||
map (\f -> Git.workTree repo ++ "/" ++ f) typechangedfiles
|
map (\f -> Git.workTree repo ++ "/" ++ f) typechangedfiles
|
||||||
unlockedfiles' <- filterFiles unlockedfiles
|
unlockedfiles' <- filterFiles unlockedfiles
|
||||||
backendPairs a unlockedfiles'
|
backendPairs a unlockedfiles'
|
||||||
withKeys :: CommandSeekStrings
|
withKeys :: CommandSeekKeys
|
||||||
withKeys a params = return $ map a params
|
withKeys a params = return $ map a $ catMaybes $ map readKey params
|
||||||
withTempFile :: CommandSeekStrings
|
withTempFile :: CommandSeekStrings
|
||||||
withTempFile a params = return $ map a params
|
withTempFile a params = return $ map a params
|
||||||
withNothing :: CommandSeekNothing
|
withNothing :: CommandSeekNothing
|
||||||
|
|
|
@ -14,6 +14,7 @@ import LocationLog
|
||||||
import Types
|
import Types
|
||||||
import Content
|
import Content
|
||||||
import Messages
|
import Messages
|
||||||
|
import Key
|
||||||
|
|
||||||
command :: [Command]
|
command :: [Command]
|
||||||
command = [Command "dropkey" (paramRepeating paramKey) seek
|
command = [Command "dropkey" (paramRepeating paramKey) seek
|
||||||
|
@ -22,21 +23,16 @@ command = [Command "dropkey" (paramRepeating paramKey) seek
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withKeys start]
|
seek = [withKeys start]
|
||||||
|
|
||||||
{- Drops cached content for a key. -}
|
start :: CommandStartKey
|
||||||
start :: CommandStartString
|
start key = do
|
||||||
start keyname = do
|
present <- inAnnex key
|
||||||
backends <- Backend.list
|
|
||||||
let key = error "fixme!!"
|
|
||||||
--let key = genKey (head backends) keyname --TODO FIXME
|
|
||||||
let present = error "fixme!!"
|
|
||||||
--present <- inAnnex key
|
|
||||||
force <- Annex.getState Annex.force
|
force <- Annex.getState Annex.force
|
||||||
if not present
|
if not present
|
||||||
then return Nothing
|
then return Nothing
|
||||||
else if not force
|
else if not force
|
||||||
then error "dropkey is can cause data loss; use --force if you're sure you want to do this"
|
then error "dropkey is can cause data loss; use --force if you're sure you want to do this"
|
||||||
else do
|
else do
|
||||||
showStart "dropkey" keyname
|
showStart "dropkey" (show key)
|
||||||
return $ Just $ perform key
|
return $ Just $ perform key
|
||||||
|
|
||||||
perform :: Key -> CommandPerform
|
perform :: Key -> CommandPerform
|
||||||
|
|
|
@ -12,9 +12,6 @@ import System.Exit
|
||||||
|
|
||||||
import Command
|
import Command
|
||||||
import Content
|
import Content
|
||||||
import qualified Backend
|
|
||||||
import qualified BackendClass
|
|
||||||
import Key
|
|
||||||
|
|
||||||
command :: [Command]
|
command :: [Command]
|
||||||
command = [Command "inannex" (paramRepeating paramKey) seek
|
command = [Command "inannex" (paramRepeating paramKey) seek
|
||||||
|
@ -23,14 +20,8 @@ command = [Command "inannex" (paramRepeating paramKey) seek
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withKeys start]
|
seek = [withKeys start]
|
||||||
|
|
||||||
start :: CommandStartString
|
start :: CommandStartKey
|
||||||
start keyname = do
|
start key = do
|
||||||
backends <- Backend.list
|
|
||||||
let key = stubKey {
|
|
||||||
keyName = keyname,
|
|
||||||
keyBackendName = BackendClass.name (head backends)
|
|
||||||
}
|
|
||||||
error "BROKEN. fixme!"
|
|
||||||
present <- inAnnex key
|
present <- inAnnex key
|
||||||
if present
|
if present
|
||||||
then return Nothing
|
then return Nothing
|
||||||
|
|
|
@ -12,10 +12,8 @@ import Control.Monad.State (liftIO)
|
||||||
import System.Exit
|
import System.Exit
|
||||||
|
|
||||||
import Command
|
import Command
|
||||||
import Types
|
|
||||||
import CmdLine
|
import CmdLine
|
||||||
import Content
|
import Content
|
||||||
import qualified Backend
|
|
||||||
import RsyncFile
|
import RsyncFile
|
||||||
|
|
||||||
command :: [Command]
|
command :: [Command]
|
||||||
|
@ -25,12 +23,8 @@ command = [Command "recvkey" paramKey seek
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withKeys start]
|
seek = [withKeys start]
|
||||||
|
|
||||||
start :: CommandStartString
|
start :: CommandStartKey
|
||||||
start keyname = do
|
start key = do
|
||||||
error "BROKEN FIXME!"
|
|
||||||
{-
|
|
||||||
backends <- Backend.list
|
|
||||||
let key = genKey (head backends) keyname
|
|
||||||
present <- inAnnex key
|
present <- inAnnex key
|
||||||
when present $
|
when present $
|
||||||
error "key is already present in annex"
|
error "key is already present in annex"
|
||||||
|
@ -43,4 +37,3 @@ start keyname = do
|
||||||
_ <- shutdown
|
_ <- shutdown
|
||||||
liftIO exitSuccess
|
liftIO exitSuccess
|
||||||
else liftIO exitFailure
|
else liftIO exitFailure
|
||||||
-}
|
|
||||||
|
|
|
@ -14,9 +14,7 @@ import System.Exit
|
||||||
import Locations
|
import Locations
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
import Command
|
import Command
|
||||||
import Types
|
|
||||||
import Content
|
import Content
|
||||||
import qualified Backend
|
|
||||||
import RsyncFile
|
import RsyncFile
|
||||||
|
|
||||||
command :: [Command]
|
command :: [Command]
|
||||||
|
@ -26,16 +24,11 @@ command = [Command "sendkey" paramKey seek
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withKeys start]
|
seek = [withKeys start]
|
||||||
|
|
||||||
start :: CommandStartString
|
start :: CommandStartKey
|
||||||
start keyname = do
|
start key = do
|
||||||
error "BROKEN FIXME!"
|
|
||||||
{-
|
|
||||||
backends <- Backend.list
|
|
||||||
let key = genKey (head backends) keyname
|
|
||||||
present <- inAnnex key
|
present <- inAnnex key
|
||||||
g <- Annex.gitRepo
|
g <- Annex.gitRepo
|
||||||
let file = gitAnnexLocation g key
|
let file = gitAnnexLocation g key
|
||||||
when present $
|
when present $
|
||||||
liftIO $ rsyncServerSend file
|
liftIO $ rsyncServerSend file
|
||||||
liftIO exitFailure
|
liftIO exitFailure
|
||||||
-}
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ Many git-annex commands will stage changes for later `git commit` by you.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
git annex dropkey --key=SHA1-s10-7da006579dd64330eb2456001fd01948430572f2
|
git annex dropkey SHA1-s10-7da006579dd64330eb2456001fd01948430572f2
|
||||||
|
|
||||||
* setkey file
|
* setkey file
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue