diff options
-rw-r--r-- | Backend/File.hs | 4 | ||||
-rw-r--r-- | Command/Move.hs | 4 | ||||
-rw-r--r-- | Remote.hs | 22 | ||||
-rw-r--r-- | debian/changelog | 1 |
4 files changed, 24 insertions, 7 deletions
diff --git a/Backend/File.hs b/Backend/File.hs index eab987ef8..675b48307 100644 --- a/Backend/File.hs +++ b/Backend/File.hs @@ -52,7 +52,7 @@ dummyStore _ _ = return True - and copy it to here. -} copyKeyFile :: Key -> FilePath -> Annex Bool copyKeyFile key file = do - (remotes, _) <- Remote.keyPossibilities key + remotes <- Remote.keyPossibilities key if null remotes then do showNote "not available" @@ -95,7 +95,7 @@ checkRemoveKey key numcopiesM = do if force || numcopiesM == Just 0 then return True else do - (remotes, trusteduuids) <- Remote.keyPossibilities key + (remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key untrusteduuids <- trustGet UnTrusted let tocheck = Remote.remotesWithoutUUID remotes (trusteduuids++untrusteduuids) numcopies <- getNumCopies numcopiesM diff --git a/Command/Move.hs b/Command/Move.hs index 7fa195bab..03b605ce5 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -89,7 +89,7 @@ toPerform dest move key = do let fastcheck = fast && not move && not (Remote.hasKeyCheap dest) isthere <- if fastcheck then do - (remotes, _) <- Remote.keyPossibilities key + remotes <- Remote.keyPossibilities key return $ Right $ dest `elem` remotes else Remote.hasKey dest key case isthere of @@ -123,7 +123,7 @@ fromStart :: Remote.Remote Annex -> Bool -> CommandStartString fromStart src move file = isAnnexed file $ \(key, _) -> do g <- Annex.gitRepo u <- getUUID g - (remotes, _) <- Remote.keyPossibilities key + remotes <- Remote.keyPossibilities key if (u == Remote.uuid src) || (null $ filter (== src) remotes) then stop else do @@ -15,6 +15,7 @@ module Remote ( hasKey, hasKeyCheap, keyPossibilities, + keyPossibilitiesTrusted, forceTrust, remoteTypes, @@ -128,12 +129,29 @@ remotesWithoutUUID :: [Remote Annex] -> [UUID] -> [Remote Annex] remotesWithoutUUID rs us = filter (\r -> uuid r `notElem` us) rs {- Cost ordered lists of remotes that the LocationLog indicate may have a key. + -} +keyPossibilities :: Key -> Annex [Remote Annex] +keyPossibilities key = do + g <- Annex.gitRepo + u <- getUUID g + + -- get uuids of all remotes that are recorded to have the key + uuids <- keyLocations key + let validuuids = filter (/= u) uuids + + -- remotes that match uuids that have the key + allremotes <- genList + let validremotes = remotesWithUUID allremotes validuuids + + return $ sort validremotes + +{- Cost ordered lists of remotes that the LocationLog indicate may have a key. - - Also returns a list of UUIDs that are trusted to have the key - (some may not have configured remotes). -} -keyPossibilities :: Key -> Annex ([Remote Annex], [UUID]) -keyPossibilities key = do +keyPossibilitiesTrusted :: Key -> Annex ([Remote Annex], [UUID]) +keyPossibilitiesTrusted key = do g <- Annex.gitRepo u <- getUUID g trusted <- trustGet Trusted diff --git a/debian/changelog b/debian/changelog index 3fc7216e2..69b28c455 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,7 +5,6 @@ git-annex (3.20110611) UNRELEASED; urgency=low * merge: New subcommand. Auto-merges the new git-annex branch. * Improved handling of bare git repos with annexes. Many more commands will work in them. - * Sped up many commands. * git-annex is now more robust; it will never leave state files uncommitted when some other git process comes along and locks the index at an inconvenient time. |