summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-04-09 12:41:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-04-09 12:41:17 -0400
commitc739c7d7872557ca0c5d3518fb0a3bdbade871eb (patch)
treed89efa77d787bd3aa5ee29a5fafed5e3c9aea641
parent141e55ff11394e2f162397957c96c02ad3f0bd37 (diff)
change name of buprepo
Instead of remote=, use buprepo= Anyone already using bup will need to re-run git annex initremote.
-rw-r--r--Remote/Bup.hs54
-rw-r--r--doc/special_remotes/bup.mdwn6
-rw-r--r--doc/walkthrough/using_bup.mdwn4
3 files changed, 35 insertions, 29 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs
index d43b03a92..b6d08d89b 100644
--- a/Remote/Bup.hs
+++ b/Remote/Bup.hs
@@ -33,26 +33,27 @@ import Ssh
remote :: RemoteType Annex
remote = RemoteType {
typename = "bup",
- enumerate = findSpecialRemotes "bupremote",
+ enumerate = findSpecialRemotes "buprepo",
generate = gen,
setup = bupSetup
}
gen :: Git.Repo -> UUID -> Maybe (M.Map String String) -> Annex (Remote Annex)
gen r u c = do
- bupremote <- getConfig r "bupremote" (error "missing bupremote")
- cst <- remoteCost r (if bupLocal bupremote then semiCheapRemoteCost else expensiveRemoteCost)
+ buprepo <- getConfig r "buprepo" (error "missing buprepo")
+ cst <- remoteCost r (if bupLocal buprepo then semiCheapRemoteCost else expensiveRemoteCost)
+-- u' <- getBupUUID r u
- return $ this cst bupremote
+ return $ this cst buprepo u'
where
- this cst bupremote = Remote {
- uuid = u,
+ this cst buprepo u' = Remote {
+ uuid = u',
cost = cst,
name = Git.repoDescribe r,
- storeKey = store r bupremote,
- retrieveKeyFile = retrieve bupremote,
+ storeKey = store r buprepo,
+ retrieveKeyFile = retrieve buprepo,
removeKey = remove,
- hasKey = checkPresent u,
+ hasKey = checkPresent u',
hasKeyCheap = True,
config = c
}
@@ -60,7 +61,7 @@ gen r u c = do
bupSetup :: UUID -> M.Map String String -> Annex (M.Map String String)
bupSetup u c = do
-- verify configuration is sane
- let bupremote = case M.lookup "remote" c of
+ let buprepo = case M.lookup "remote" c of
Nothing -> error "Specify remote="
Just r -> r
case M.lookup "encryption" c of
@@ -71,37 +72,37 @@ bupSetup u c = do
-- bup init will create the repository.
-- (If the repository already exists, bup init again appears safe.)
showNote "bup init"
- ok <- bup "init" bupremote []
+ ok <- bup "init" buprepo []
unless ok $ error "bup init failed"
- storeBupUUID u bupremote
+ storeBupUUID u buprepo
- -- The bup remote is stored in git config, as well as this remote's
+ -- The buprepo is stored in git config, as well as this repo's
-- persistant state, so it can vary between hosts.
- gitConfigSpecialRemote u c "bupremote" bupremote
+ gitConfigSpecialRemote u c "buprepo" buprepo
return $ M.delete "directory" c
bupParams :: String -> String -> [CommandParam] -> [CommandParam]
-bupParams command bupremote params =
- (Param command) : [Param "-r", Param bupremote] ++ params
+bupParams command buprepo params =
+ (Param command) : [Param "-r", Param buprepo] ++ params
bup :: String -> String -> [CommandParam] -> Annex Bool
-bup command bupremote params = do
+bup command buprepo params = do
showProgress -- make way for bup output
- liftIO $ boolSystem "bup" $ bupParams command bupremote params
+ liftIO $ boolSystem "bup" $ bupParams command buprepo params
store :: Git.Repo -> String -> Key -> Annex Bool
-store r bupremote k = do
+store r buprepo k = do
g <- Annex.gitRepo
let src = gitAnnexLocation g k
o <- getConfig r "bup-split-options" ""
let os = map Param $ words o
- bup "split" bupremote $ os ++ [Param "-n", Param (show k), File src]
+ bup "split" buprepo $ os ++ [Param "-n", Param (show k), File src]
retrieve :: String -> Key -> FilePath -> Annex Bool
-retrieve bupremote k f = do
- let params = bupParams "join" bupremote [Param $ show k]
+retrieve buprepo k f = do
+ let params = bupParams "join" buprepo [Param $ show k]
ret <- liftIO $ try $ do
-- pipe bup's stdout directly to file
tofile <- openFile f WriteMode
@@ -140,8 +141,8 @@ checkPresent u k = do
{- Store UUID in the annex.uuid setting of the bup repository. -}
storeBupUUID :: UUID -> FilePath -> Annex ()
-storeBupUUID u bupremote = do
- r <- liftIO $ bup2GitRemote bupremote
+storeBupUUID u buprepo = do
+ r <- liftIO $ bup2GitRemote buprepo
if Git.repoIsUrl r
then do
showNote "storing uuid"
@@ -157,6 +158,11 @@ storeBupUUID u bupremote = do
when (olduuid == "") $
Git.run r' "config" [Param "annex.uuid", Param u]
+{- Allow for bup repositories on removable media by checking
+ - local bup repositories -}
+--getBupUUID :: UUID -> FilePath -> Annex ()
+--getBupUUID u buprepo = do
+
{- Converts a bup remote path spec into a Git.Repo. There are some
- differences in path representation between git and bup. -}
bup2GitRemote :: FilePath -> IO Git.Repo
diff --git a/doc/special_remotes/bup.mdwn b/doc/special_remotes/bup.mdwn
index 19f2320f8..c74bdaf7e 100644
--- a/doc/special_remotes/bup.mdwn
+++ b/doc/special_remotes/bup.mdwn
@@ -21,10 +21,10 @@ These parameters can be passed to `git annex initremote` to configure bup:
keys can be given access to a remote by rerunning initremote with
the new key id.
-* `remote` - Required. This is passed to `bup` as the `--remote`
+* `buprepo` - Required. This is passed to `bup` as the `--remote`
to use to store data. To create the repository,`bup init` will be run.
- Example: "remote=example.com:/big/mybup" or "remote=/big/mybup"
- (To use the default `~/.bup` repository on the local host, specify "remote=")
+ Example: "buprepo=example.com:/big/mybup" or "buprepo=/big/mybup"
+ (To use the default `~/.bup` repository on the local host, specify "buprepo=")
Options to pass to `bup split` when sending content to bup can also
be specified, by using `git config annex.bup-split-options`. This
diff --git a/doc/walkthrough/using_bup.mdwn b/doc/walkthrough/using_bup.mdwn
index c3200dd32..3a6a8776a 100644
--- a/doc/walkthrough/using_bup.mdwn
+++ b/doc/walkthrough/using_bup.mdwn
@@ -8,10 +8,10 @@ Here's how to create a bup remote, and describe it.
[[!template id=note text="""
Instead of specifying a remote system, you could choose to make a bup
remote that is only accessible on the current system, by passing
-"remote=/big/mybup".
+"buprepo=/big/mybup".
"""]]
- # git annex initremote mybup type=bup encryption=none remote=example.com:/big/mybup
+ # git annex initremote mybup type=bup encryption=none buprepo=example.com:/big/mybup
initremote bup (bup init)
Initialized empty Git repository in /big/mybup/
ok