summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-28 17:37:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-28 17:45:47 -0400
commite32ab766b08b9a64bf12fe5ab6bf33f2d82b0fb7 (patch)
tree8fdccb1bd129e25af9d6ba84bb32e04b40992c1f
parent16653132b7f7452b9c3758696093eda0f2d543c1 (diff)
--inbackend can be used to make git-annex only operate on files whose content is stored using a specified key-value backend.
-rw-r--r--GitAnnex.hs2
-rw-r--r--Limit.hs7
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex.mdwn5
4 files changed, 16 insertions, 0 deletions
diff --git a/GitAnnex.hs b/GitAnnex.hs
index f563c08cb..42a6b7fd7 100644
--- a/GitAnnex.hs
+++ b/GitAnnex.hs
@@ -111,6 +111,8 @@ options = commonOptions ++
"skip files not present in a remote"
, Option ['C'] ["copies"] (ReqArg Limit.addCopies paramNumber)
"skip files with fewer copies"
+ , Option ['B'] ["inbackend"] (ReqArg Limit.addInBackend paramName)
+ "skip files not using a key-value backend"
] ++ matcherOptions
where
setto v = Annex.changeState $ \s -> s { Annex.toremote = Just v }
diff --git a/Limit.hs b/Limit.hs
index 3ae949bfb..c68c3bdd8 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -88,3 +88,10 @@ addCopies num =
handle n (Just (key, _)) = do
us <- keyLocations key
return $ length us >= n
+
+{- Adds a limit to skip files not using a specified key-value backend. -}
+addInBackend :: String -> Annex ()
+addInBackend name = addLimit $ Backend.lookupFile >=> check
+ where
+ wanted = Backend.lookupBackendName name
+ check = return . maybe False ((==) wanted . snd)
diff --git a/debian/changelog b/debian/changelog
index 265ba7184..9cd915885 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ git-annex (3.20111123) UNRELEASED; urgency=low
* Bugfix: dropunused did not drop keys with two spaces in their name.
* Support for storing .git/annex on a different device than the rest of the
git repository.
+ * --inbackend can be used to make git-annex only operate on files
+ whose content is stored using a specified key-value backend.
-- Joey Hess <joeyh@debian.org> Tue, 22 Nov 2011 17:53:42 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index c225529de..cedb2e782 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -446,6 +446,11 @@ file contents are present at either of two repositories.
Matches only files that git-annex believes to have the specified number
of copies, or more.
+* --inbackend=name
+
+ Matches only files whose content is stored using the specified key-value
+ backend.
+
* --not
Inverts the next file matching option. For example, to only act on