summaryrefslogtreecommitdiff
path: root/Commands.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-16 16:15:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-16 16:15:31 -0400
commit6d13ae10cf1d295b64855984f5a526f8209f3341 (patch)
tree70baa5f95943631e0f0e03a86ef8f57ee5480680 /Commands.hs
parent81d628a8cd6f20c2ef336271ae03376dc75b6920 (diff)
git annex describe
Diffstat (limited to 'Commands.hs')
-rw-r--r--Commands.hs24
1 files changed, 17 insertions, 7 deletions
diff --git a/Commands.hs b/Commands.hs
index 11f808c21..1f9128011 100644
--- a/Commands.hs
+++ b/Commands.hs
@@ -23,7 +23,7 @@ import Core
import qualified Remotes
import qualified BackendTypes
-data CmdWants = FilesInGit | FilesNotInGit | RepoName
+data CmdWants = FilesInGit | FilesNotInGit | RepoName | SingleString
data Command = Command {
cmdname :: String,
cmdaction :: (String -> Annex ()),
@@ -34,10 +34,10 @@ cmds :: [Command]
cmds = [ (Command "add" addCmd FilesNotInGit)
, (Command "get" getCmd FilesInGit)
, (Command "drop" dropCmd FilesInGit)
- , (Command "want" wantCmd FilesInGit)
, (Command "push" pushCmd RepoName)
, (Command "pull" pullCmd RepoName)
, (Command "unannex" unannexCmd FilesInGit)
+ , (Command "describe" describeCmd SingleString)
]
{- Finds the type of parameters a command wants, from among the passed
@@ -49,6 +49,8 @@ findWanted FilesNotInGit params repo = do
findWanted FilesInGit params repo = do
files <- mapM (Git.inRepo repo) params
return $ foldl (++) [] files
+findWanted SingleString params _ = do
+ return $ [unwords params]
findWanted RepoName params _ = do
return $ params
@@ -150,11 +152,8 @@ getCmd file = notinBackend file err $ \(key, backend) -> do
where
err = error $ "not annexed " ++ file
-{- Indicates a file is wanted. -}
-wantCmd :: FilePath -> Annex ()
-wantCmd file = do error "not implemented" -- TODO
-
-{- Indicates a file is not wanted. -}
+{- Indicates a file's content is not wanted anymore, and should be removed
+ - if it's safe to do so. -}
dropCmd :: FilePath -> Annex ()
dropCmd file = notinBackend file err $ \(key, backend) -> do
force <- Annex.flagIsSet Force
@@ -185,6 +184,17 @@ pushCmd reponame = do error "not implemented" -- TODO
pullCmd :: String -> Annex ()
pullCmd reponame = do error "not implemented" -- TODO
+{- Stores description for the repository. -}
+describeCmd :: String -> Annex ()
+describeCmd description = do
+ g <- Annex.gitRepo
+ u <- getUUID g
+ describeUUID u description
+ log <- uuidLog
+ liftIO $ Git.run g ["add", log]
+ Annex.flagChange NeedCommit True
+ liftIO $ putStrLn "description set"
+
{- Updates the LocationLog when a key's presence changes. -}
logStatus :: Key -> LogStatus -> Annex ()
logStatus key status = do