summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex.hs4
-rw-r--r--Backend.hs15
-rw-r--r--Options.hs6
-rw-r--r--debian/changelog1
4 files changed, 17 insertions, 9 deletions
diff --git a/Annex.hs b/Annex.hs
index b2257281f..2148dd625 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -38,7 +38,7 @@ data AnnexState = AnnexState
, quiet :: Bool
, force :: Bool
, fast :: Bool
- , defaultbackend :: Maybe String
+ , forcebackend :: Maybe String
, defaultkey :: Maybe String
, toremote :: Maybe String
, fromremote :: Maybe String
@@ -56,7 +56,7 @@ newState gitrepo allbackends = AnnexState
, quiet = False
, force = False
, fast = False
- , defaultbackend = Nothing
+ , forcebackend = Nothing
, defaultkey = Nothing
, toremote = Nothing
, fromremote = Nothing
diff --git a/Backend.hs b/Backend.hs
index 6140664ce..ab15974c8 100644
--- a/Backend.hs
+++ b/Backend.hs
@@ -33,6 +33,7 @@ module Backend (
) where
import Control.Monad.State (liftIO, when)
+import Control.Monad (liftM)
import System.IO.Error (try)
import System.FilePath
import System.Posix.Files
@@ -56,7 +57,7 @@ list = do
then return l
else do
s <- getstandard
- d <- Annex.getState Annex.defaultbackend
+ d <- Annex.getState Annex.forcebackend
handle d s
where
parseBackendList l [] = l
@@ -161,9 +162,15 @@ lookupFile file = do
chooseBackends :: [FilePath] -> Annex [(FilePath, Maybe (Backend Annex))]
chooseBackends fs = do
g <- Annex.gitRepo
- bs <- Annex.getState Annex.supportedBackends
- pairs <- liftIO $ Git.checkAttr g "annex.backend" fs
- return $ map (\(f,b) -> (f, maybeLookupBackendName bs b)) pairs
+ forced <- Annex.getState Annex.forcebackend
+ if forced /= Nothing
+ then do
+ l <- list
+ return $ map (\f -> (f, Just $ head l)) fs
+ else do
+ bs <- Annex.getState Annex.supportedBackends
+ pairs <- liftIO $ Git.checkAttr g "annex.backend" fs
+ return $ map (\(f,b) -> (f, maybeLookupBackendName bs b)) pairs
{- Returns the backend to use for a key. -}
keyBackend :: Key -> Annex (Backend Annex)
diff --git a/Options.hs b/Options.hs
index 31b73e25a..ae5707e4a 100644
--- a/Options.hs
+++ b/Options.hs
@@ -28,11 +28,11 @@ commonOptions =
"avoid verbose output"
, Option ['v'] ["verbose"] (NoArg (setquiet False))
"allow verbose output"
- , Option ['b'] ["backend"] (ReqArg setdefaultbackend paramName)
- "specify default key-value backend to use"
+ , Option ['b'] ["backend"] (ReqArg setforcebackend paramName)
+ "specify key-value backend to use"
]
where
setforce v = Annex.changeState $ \s -> s { Annex.force = v }
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
setquiet v = Annex.changeState $ \s -> s { Annex.quiet = v }
- setdefaultbackend v = Annex.changeState $ \s -> s { Annex.defaultbackend = Just v }
+ setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
diff --git a/debian/changelog b/debian/changelog
index d759d3672..f8b5f02cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
git-annex (0.20110517) UNRELEASED; urgency=low
* status: New subcommand to show info about an annex, including its size.
+ * --backend now overrides any backend configured in .gitattributes files.
-- Joey Hess <joeyh@debian.org> Mon, 16 May 2011 20:27:46 -0400