diff options
-rw-r--r-- | Command/Drop.hs | 27 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/git-annex-drop.mdwn | 15 |
3 files changed, 34 insertions, 9 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs index a3ac87633..698dd7bad 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -27,7 +27,7 @@ cmd = [withOptions (dropOptions) $ command "drop" paramPaths seek SectionCommon "indicate content of files not currently wanted"] dropOptions :: [Option] -dropOptions = dropFromOption : annexedMatchingOptions ++ [autoOption] +dropOptions = dropFromOption : annexedMatchingOptions ++ [autoOption] ++ keyOptions dropFromOption :: Option dropFromOption = fieldOption ['f'] "from" paramRemote "drop content from a remote" @@ -36,23 +36,32 @@ seek :: CommandSeek seek ps = do from <- getOptionField dropFromOption Remote.byNameWithUUID auto <- getOptionFlag autoOption - withFilesInGit (whenAnnexed $ start auto from) ps + withKeyOptions auto + (startKeys auto from) + (withFilesInGit $ whenAnnexed $ start auto from) + ps start :: Bool -> Maybe Remote -> FilePath -> Key -> CommandStart -start auto from file key = checkDropAuto auto from file key $ \numcopies -> +start auto from file key = start' auto from key (Just file) + +start' :: Bool -> Maybe Remote -> Key -> AssociatedFile -> CommandStart +start' auto from key afile = checkDropAuto auto from afile key $ \numcopies -> stopUnless want $ case from of - Nothing -> startLocal (Just file) numcopies key Nothing + Nothing -> startLocal afile numcopies key Nothing Just remote -> do u <- getUUID if Remote.uuid remote == u - then startLocal (Just file) numcopies key Nothing - else startRemote (Just file) numcopies key remote + then startLocal afile numcopies key Nothing + else startRemote afile numcopies key remote where want - | auto = wantDrop False (Remote.uuid <$> from) (Just key) (Just file) + | auto = wantDrop False (Remote.uuid <$> from) (Just key) afile | otherwise = return True +startKeys :: Bool -> Maybe Remote -> Key -> CommandStart +startKeys auto from key = start' auto from key Nothing + startLocal :: AssociatedFile -> NumCopies -> Key -> Maybe Remote -> CommandStart startLocal afile numcopies key knownpresentremote = stopUnless (inAnnex key) $ do showStart' "drop" key afile @@ -154,8 +163,8 @@ requiredContent = do {- In auto mode, only runs the action if there are enough - copies on other semitrusted repositories. -} -checkDropAuto :: Bool -> Maybe Remote -> FilePath -> Key -> (NumCopies -> CommandStart) -> CommandStart -checkDropAuto auto mremote file key a = go =<< getFileNumCopies file +checkDropAuto :: Bool -> Maybe Remote -> AssociatedFile -> Key -> (NumCopies -> CommandStart) -> CommandStart +checkDropAuto auto mremote afile key a = go =<< maybe getNumCopies getFileNumCopies afile where go numcopies | auto = do diff --git a/debian/changelog b/debian/changelog index 58921d5a9..6b3dfb38d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ git-annex (5.20150508.2) UNRELEASED; urgency=medium * import: Refuse to import files that are within the work tree, as that does not make sense and could cause data loss. + * drop: Now supports --all, --unused, and --key. -- Joey Hess <id@joeyh.name> Mon, 11 May 2015 12:45:06 -0400 diff --git a/doc/git-annex-drop.mdwn b/doc/git-annex-drop.mdwn index 3fd13467c..c19a716e9 100644 --- a/doc/git-annex-drop.mdwn +++ b/doc/git-annex-drop.mdwn @@ -35,6 +35,21 @@ safe to do so. the last repository that is storing their content. Data loss can result from using this option. +* `--all` + + Rather than specifying a filename or path to drop, this option can be + used to drop all available versions of all files. + + This is the default behavior when running git-annex drop in a bare repository. + +* `--unused` + + Drop files found by last run of git-annex unused. + +* `--key=keyname` + + Use this option to drop a specified key. + * file matching options The [[git-annex-matching-options]](1) |