avoid unnecessary read of trust.log
This commit is contained in:
parent
aec4709c3f
commit
7ee636f6dd
4 changed files with 24 additions and 7 deletions
|
@ -52,7 +52,7 @@ dummyStore _ _ = return True
|
||||||
- and copy it to here. -}
|
- and copy it to here. -}
|
||||||
copyKeyFile :: Key -> FilePath -> Annex Bool
|
copyKeyFile :: Key -> FilePath -> Annex Bool
|
||||||
copyKeyFile key file = do
|
copyKeyFile key file = do
|
||||||
(remotes, _) <- Remote.keyPossibilities key
|
remotes <- Remote.keyPossibilities key
|
||||||
if null remotes
|
if null remotes
|
||||||
then do
|
then do
|
||||||
showNote "not available"
|
showNote "not available"
|
||||||
|
@ -95,7 +95,7 @@ checkRemoveKey key numcopiesM = do
|
||||||
if force || numcopiesM == Just 0
|
if force || numcopiesM == Just 0
|
||||||
then return True
|
then return True
|
||||||
else do
|
else do
|
||||||
(remotes, trusteduuids) <- Remote.keyPossibilities key
|
(remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key
|
||||||
untrusteduuids <- trustGet UnTrusted
|
untrusteduuids <- trustGet UnTrusted
|
||||||
let tocheck = Remote.remotesWithoutUUID remotes (trusteduuids++untrusteduuids)
|
let tocheck = Remote.remotesWithoutUUID remotes (trusteduuids++untrusteduuids)
|
||||||
numcopies <- getNumCopies numcopiesM
|
numcopies <- getNumCopies numcopiesM
|
||||||
|
|
|
@ -89,7 +89,7 @@ toPerform dest move key = do
|
||||||
let fastcheck = fast && not move && not (Remote.hasKeyCheap dest)
|
let fastcheck = fast && not move && not (Remote.hasKeyCheap dest)
|
||||||
isthere <- if fastcheck
|
isthere <- if fastcheck
|
||||||
then do
|
then do
|
||||||
(remotes, _) <- Remote.keyPossibilities key
|
remotes <- Remote.keyPossibilities key
|
||||||
return $ Right $ dest `elem` remotes
|
return $ Right $ dest `elem` remotes
|
||||||
else Remote.hasKey dest key
|
else Remote.hasKey dest key
|
||||||
case isthere of
|
case isthere of
|
||||||
|
@ -123,7 +123,7 @@ fromStart :: Remote.Remote Annex -> Bool -> CommandStartString
|
||||||
fromStart src move file = isAnnexed file $ \(key, _) -> do
|
fromStart src move file = isAnnexed file $ \(key, _) -> do
|
||||||
g <- Annex.gitRepo
|
g <- Annex.gitRepo
|
||||||
u <- getUUID g
|
u <- getUUID g
|
||||||
(remotes, _) <- Remote.keyPossibilities key
|
remotes <- Remote.keyPossibilities key
|
||||||
if (u == Remote.uuid src) || (null $ filter (== src) remotes)
|
if (u == Remote.uuid src) || (null $ filter (== src) remotes)
|
||||||
then stop
|
then stop
|
||||||
else do
|
else do
|
||||||
|
|
22
Remote.hs
22
Remote.hs
|
@ -15,6 +15,7 @@ module Remote (
|
||||||
hasKey,
|
hasKey,
|
||||||
hasKeyCheap,
|
hasKeyCheap,
|
||||||
keyPossibilities,
|
keyPossibilities,
|
||||||
|
keyPossibilitiesTrusted,
|
||||||
forceTrust,
|
forceTrust,
|
||||||
|
|
||||||
remoteTypes,
|
remoteTypes,
|
||||||
|
@ -127,13 +128,30 @@ remotesWithUUID rs us = filter (\r -> uuid r `elem` us) rs
|
||||||
remotesWithoutUUID :: [Remote Annex] -> [UUID] -> [Remote Annex]
|
remotesWithoutUUID :: [Remote Annex] -> [UUID] -> [Remote Annex]
|
||||||
remotesWithoutUUID rs us = filter (\r -> uuid r `notElem` us) rs
|
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.
|
{- 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
|
- Also returns a list of UUIDs that are trusted to have the key
|
||||||
- (some may not have configured remotes).
|
- (some may not have configured remotes).
|
||||||
-}
|
-}
|
||||||
keyPossibilities :: Key -> Annex ([Remote Annex], [UUID])
|
keyPossibilitiesTrusted :: Key -> Annex ([Remote Annex], [UUID])
|
||||||
keyPossibilities key = do
|
keyPossibilitiesTrusted key = do
|
||||||
g <- Annex.gitRepo
|
g <- Annex.gitRepo
|
||||||
u <- getUUID g
|
u <- getUUID g
|
||||||
trusted <- trustGet Trusted
|
trusted <- trustGet Trusted
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -5,7 +5,6 @@ git-annex (3.20110611) UNRELEASED; urgency=low
|
||||||
* merge: New subcommand. Auto-merges the new git-annex branch.
|
* merge: New subcommand. Auto-merges the new git-annex branch.
|
||||||
* Improved handling of bare git repos with annexes. Many more commands will
|
* Improved handling of bare git repos with annexes. Many more commands will
|
||||||
work in them.
|
work in them.
|
||||||
* Sped up many commands.
|
|
||||||
* git-annex is now more robust; it will never leave state files
|
* git-annex is now more robust; it will never leave state files
|
||||||
uncommitted when some other git process comes along and locks the index
|
uncommitted when some other git process comes along and locks the index
|
||||||
at an inconvenient time.
|
at an inconvenient time.
|
||||||
|
|
Loading…
Reference in a new issue