Merge branch 'master' into adjustedbranch

This commit is contained in:
Joey Hess 2016-03-11 12:21:26 -04:00
commit 97e97dccda
Failed to extract signature
69 changed files with 901 additions and 1080 deletions

View file

@ -1,6 +1,6 @@
{- git-annex command
-
- Copyright 2010 Joey Hess <id@joeyh.name>
- Copyright 2010,2016 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@ -13,26 +13,45 @@ import Logs.Location
import Annex.Content
cmd :: Command
cmd = noCommit $
cmd = noCommit $ withGlobalOptions [jsonOption] $
command "dropkey" SectionPlumbing
"drops annexed content for specified keys"
(paramRepeating paramKey)
(withParams seek)
(seek <$$> optParser)
seek :: CmdParams -> CommandSeek
seek = withKeys start
data DropKeyOptions = DropKeyOptions
{ toDrop :: [String]
, batchOption :: BatchMode
}
start :: Key -> CommandStart
start key = stopUnless (inAnnex key) $ do
optParser :: CmdParamsDesc -> Parser DropKeyOptions
optParser desc = DropKeyOptions
<$> cmdParams desc
<*> parseBatchOption
seek :: DropKeyOptions -> CommandSeek
seek o = do
unlessM (Annex.getState Annex.force) $
error "dropkey can cause data loss; use --force if you're sure you want to do this"
withKeys start (toDrop o)
case batchOption o of
Batch -> batchInput parsekey $ batchCommandAction . start
NoBatch -> noop
where
parsekey = maybe (Left "bad key") Right . file2key
start :: Key -> CommandStart
start key = do
showStart' "dropkey" key Nothing
next $ perform key
perform :: Key -> CommandPerform
perform key = lockContentForRemoval key $ \contentlock -> do
removeAnnex contentlock
next $ cleanup key
perform key = ifM (inAnnex key)
( lockContentForRemoval key $ \contentlock -> do
removeAnnex contentlock
next $ cleanup key
, next $ return True
)
cleanup :: Key -> CommandCleanup
cleanup key = do

View file

@ -18,11 +18,7 @@ import Annex.Content
import Annex.Perms
import qualified Annex.Queue
import qualified Database.Keys
#ifdef WITH_CLIBS
#ifndef __ANDROID__
import Utility.Touch
#endif
#endif
cmd :: Command
cmd = notDirect $ noCommit $ withGlobalOptions annexedMatchingOptions $
@ -90,20 +86,16 @@ makeHardLink file key = do
fixSymlink :: FilePath -> FilePath -> CommandPerform
fixSymlink file link = do
liftIO $ do
#ifdef WITH_CLIBS
#ifndef __ANDROID__
#if ! defined(mingw32_HOST_OS) && ! defined(__ANDROID__)
-- preserve mtime of symlink
mtime <- catchMaybeIO $ TimeSpec . modificationTime
<$> getSymbolicLinkStatus file
#endif
#endif
createDirectoryIfMissing True (parentDir file)
removeFile file
createSymbolicLink link file
#ifdef WITH_CLIBS
#ifndef __ANDROID__
#if ! defined(mingw32_HOST_OS) && ! defined(__ANDROID__)
maybe noop (\t -> touch file t False) mtime
#endif
#endif
next $ cleanupSymlink file

View file

@ -522,6 +522,5 @@ syncFile ebloom rs af k = do
)
, return []
)
put dest = includeCommandAction $ do
showStart' "copy" k af
put dest = includeCommandAction $
Command.Move.toStart' dest False af k

View file

@ -13,6 +13,7 @@ import Command
import Config
import qualified Annex
import Annex.Content
import Annex.Perms
import Annex.Content.Direct
import Annex.Version
import qualified Git.Command

View file

@ -9,6 +9,7 @@ module Command.Unlock where
import Command
import Annex.Content
import Annex.Perms
import Annex.CatFile
import Annex.Version
import Annex.Link