2010-11-09 19:59:49 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
|
|
|
- Copyright 2010 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.Lock where
|
|
|
|
|
2011-10-05 20:02:51 +00:00
|
|
|
import Common.Annex
|
2010-11-09 19:59:49 +00:00
|
|
|
import Command
|
2011-10-04 04:40:47 +00:00
|
|
|
import qualified Annex.Queue
|
2010-12-30 19:06:26 +00:00
|
|
|
|
2011-10-29 19:19:05 +00:00
|
|
|
def :: [Command]
|
|
|
|
def = [command "lock" paramPaths seek "undo unlock command"]
|
2010-11-09 19:59:49 +00:00
|
|
|
|
2010-12-30 18:19:16 +00:00
|
|
|
seek :: [CommandSeek]
|
2011-05-31 18:58:06 +00:00
|
|
|
seek = [withFilesUnlocked start, withFilesUnlockedToBeCommitted start]
|
2010-11-11 22:54:52 +00:00
|
|
|
|
2012-02-14 03:42:44 +00:00
|
|
|
start :: FilePath -> CommandStart
|
|
|
|
start file = do
|
2010-11-11 21:58:55 +00:00
|
|
|
showStart "lock" file
|
2011-05-15 06:02:46 +00:00
|
|
|
next $ perform file
|
2010-11-09 19:59:49 +00:00
|
|
|
|
2010-12-30 18:19:16 +00:00
|
|
|
perform :: FilePath -> CommandPerform
|
2010-11-09 19:59:49 +00:00
|
|
|
perform file = do
|
2012-06-07 19:19:44 +00:00
|
|
|
Annex.Queue.addCommand "checkout" [Param "--"] [file]
|
2011-05-15 06:02:46 +00:00
|
|
|
next $ return True -- no cleanup needed
|