summaryrefslogtreecommitdiff
path: root/Remote/Bup.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-13 15:05:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-13 15:06:49 -0400
commit13fff71f2019ae098c3f8532ac2734cb1ab11498 (patch)
treef37714c4089df4afac9bf9724c80757e5fd29e6f /Remote/Bup.hs
parent46588674b081cd4ea5820680d8fc15c81ed175ad (diff)
split out three modules from Git
Constructors and configuration make sense in separate modules. A separate Git.Types is needed to avoid cycles.
Diffstat (limited to 'Remote/Bup.hs')
-rw-r--r--Remote/Bup.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs
index e705bbb34..4d63d88e1 100644
--- a/Remote/Bup.hs
+++ b/Remote/Bup.hs
@@ -15,6 +15,8 @@ import System.Process
import Common.Annex
import Types.Remote
import qualified Git
+import qualified Git.Config
+import qualified Git.Construct
import Config
import Annex.Ssh
import Remote.Helper.Special
@@ -163,8 +165,8 @@ storeBupUUID u buprepo = do
[Params $ "config annex.uuid " ++ v]
>>! error "ssh failed"
else liftIO $ do
- r' <- Git.configRead r
- let olduuid = Git.configGet "annex.uuid" "" r'
+ r' <- Git.Config.read r
+ let olduuid = Git.Config.get "annex.uuid" "" r'
when (olduuid == "") $
Git.run "config"
[Param "annex.uuid", Param v] r'
@@ -192,9 +194,9 @@ getBupUUID :: Git.Repo -> UUID -> Annex (UUID, Git.Repo)
getBupUUID r u
| Git.repoIsUrl r = return (u, r)
| otherwise = liftIO $ do
- ret <- try $ Git.configRead r
+ ret <- try $ Git.Config.read r
case ret of
- Right r' -> return (toUUID $ Git.configGet "annex.uuid" "" r', r')
+ Right r' -> return (toUUID $ Git.Config.get "annex.uuid" "" r', r')
Left _ -> return (NoUUID, r)
{- Converts a bup remote path spec into a Git.Repo. There are some
@@ -203,13 +205,13 @@ bup2GitRemote :: BupRepo -> IO Git.Repo
bup2GitRemote "" = do
-- bup -r "" operates on ~/.bup
h <- myHomeDir
- Git.repoFromAbsPath $ h </> ".bup"
+ Git.Construct.fromAbsPath $ h </> ".bup"
bup2GitRemote r
| bupLocal r =
if head r == '/'
- then Git.repoFromAbsPath r
+ then Git.Construct.fromAbsPath r
else error "please specify an absolute path"
- | otherwise = Git.repoFromUrl $ "ssh://" ++ host ++ slash dir
+ | otherwise = Git.Construct.fromUrl $ "ssh://" ++ host ++ slash dir
where
bits = split ":" r
host = head bits