summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-04-09 12:59:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-04-09 12:59:18 -0400
commit54286c993dab913515b12ae8d87c2944ea11e6b2 (patch)
tree0a32e311fc73a7cd4229cc3496721f471152a441 /Remote
parentf808a8335064d22fac1f9b7ee6c32a6680dd6cbc (diff)
support bup repositories on removable media
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Bup.hs19
1 files changed, 16 insertions, 3 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs
index fdc3919e2..dc653631d 100644
--- a/Remote/Bup.hs
+++ b/Remote/Bup.hs
@@ -159,10 +159,23 @@ storeBupUUID u buprepo = do
Git.run r' "config" [Param "annex.uuid", Param u]
{- Allow for bup repositories on removable media by checking
- - local bup repositories -}
+ - local bup repositories to see if they are available, and getting their
+ - uuid (which may be different from the stored uuid for the bup remote).
+ -
+ - If a bup repository is not available, returns a dummy uuid of "".
+ - This will cause checkPresent to indicate nothing from the bup remote
+ - is known to be present.
+ -}
getBupUUID :: FilePath -> UUID -> Annex UUID
-getBupUUID buprepo u = do
- return u -- TODO
+getBupUUID buprepo u = liftIO $ do
+ r <- bup2GitRemote buprepo
+ if Git.repoIsUrl r
+ then return u
+ else do
+ ret <- try $ Git.configRead r
+ case ret of
+ Right r' -> return $ Git.configGet r' "annex.uuid" ""
+ Left _ -> return ""
{- Converts a bup remote path spec into a Git.Repo. There are some
- differences in path representation between git and bup. -}