summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-26 16:44:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-26 16:44:14 -0400
commitb7903eb2d149ceb164d7422fb56573735d83ebde (patch)
tree83203e2fbc2ce7a6f5e24cfb23bfcc1b821d96cf
parent7f6af79232eee685daf58e72737c5284f80cf482 (diff)
move partitioning out of keyPossibilities
And a bug fix in passing.
-rw-r--r--Backend/File.hs8
-rw-r--r--Command/Move.hs4
-rw-r--r--Remotes.hs16
-rw-r--r--debian/changelog2
4 files changed, 11 insertions, 19 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index ac6e4a910..358bc4b7c 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -50,8 +50,7 @@ dummyStore _ _ = return True
- and copy it over to this one. -}
copyKeyFile :: Key -> FilePath -> Annex Bool
copyKeyFile key file = do
- (trusted, untrusted, _) <- Remotes.keyPossibilities key
- let remotes = trusted ++ untrusted
+ (remotes, _) <- Remotes.keyPossibilities key
if null remotes
then do
showNote "not available"
@@ -94,9 +93,10 @@ checkRemoveKey key numcopiesM = do
if force || numcopiesM == Just 0
then return True
else do
- (_, untrusted, have) <- Remotes.keyPossibilities key
+ (remotes, trusteduuids) <- Remotes.keyPossibilities key
+ untrusted <- reposWithoutUUID remotes trusteduuids
numcopies <- getNumCopies numcopiesM
- findcopies numcopies have untrusted []
+ findcopies numcopies trusteduuids untrusted []
where
findcopies need have [] bad
| length have >= need = return True
diff --git a/Command/Move.hs b/Command/Move.hs
index d52ca07df..3eadf30c6 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -110,8 +110,8 @@ toCleanup dest move key = do
fromStart :: Git.Repo -> Bool -> CommandStartString
fromStart src move file = isAnnexed file $ \(key, _) -> do
g <- Annex.gitRepo
- (trusted, untrusted, _) <- Remotes.keyPossibilities key
- if (g == src) || (null $ filter (\r -> Remotes.same r src) (trusted ++ untrusted))
+ (remotes, _) <- Remotes.keyPossibilities key
+ if (g == src) || (null $ filter (\r -> Remotes.same r src) remotes)
then return Nothing
else do
showAction move file
diff --git a/Remotes.hs b/Remotes.hs
index fe5b7f767..be4c1383a 100644
--- a/Remotes.hs
+++ b/Remotes.hs
@@ -113,14 +113,10 @@ readConfigs = do
{- Cost ordered lists of remotes that the LocationLog indicate may have a key.
-
- - The first list is of remotes that are trusted to have the key.
- -
- - The second is of untrusted remotes that may have the key.
- -
- Also returns a list of UUIDs that are trusted to have the key
- (some may not have configured remotes).
-}
-keyPossibilities :: Key -> Annex ([Git.Repo], [Git.Repo], [UUID])
+keyPossibilities :: Key -> Annex ([Git.Repo], [UUID])
keyPossibilities key = do
readConfigs
@@ -129,23 +125,17 @@ keyPossibilities key = do
u <- getUUID g
trusted <- trustGet Trusted
- -- get uuids of other repositories that are
- -- believed to have the key
+ -- get uuids of all repositories that are recorded to have the key
uuids <- liftIO $ keyLocations g key
let validuuids = filter (/= u) uuids
- -- get uuids trusted to have the key
-- note that validuuids is assumed to not have dups
let validtrusteduuids = intersect validuuids trusted
-- remotes that match uuids that have the key
validremotes <- reposByUUID allremotes validuuids
- -- partition out the trusted and untrusted remotes
- trustedremotes <- reposByUUID validremotes validtrusteduuids
- untrustedremotes <- reposWithoutUUID validremotes trusted
-
- return (trustedremotes, untrustedremotes, validtrusteduuids)
+ return (validremotes, validtrusteduuids)
{- Checks if a given remote has the content for a key inAnnex.
- If the remote cannot be accessed, returns a Left error.
diff --git a/debian/changelog b/debian/changelog
index 8b863b947..01e99ae2b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ git-annex (0.19) UNRELEASED; urgency=low
* untrust: Now marks the current repository as untrusted.
* semitrust: Now restores the default trust level. (What untrust used to do.)
* fsck: Warn if content is only in untrusted repositories.
+ * bugfix: Files were copied from trusted remotes first even if their
+ annex.cost was higher than other remotes.
-- Joey Hess <joeyh@debian.org> Wed, 19 Jan 2011 18:07:51 -0400