aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-10 21:32:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-10 21:32:42 -0400
commit2de1e2c2cee4ea75b971000fe480c48b6cbaab29 (patch)
tree20b70ceeb58147db165e3cfbdf05c5b245bf27cb
parent49d2177d51b95b4a01c05ee07e166e93751b4c51 (diff)
Optimized copy --from and get --from to avoid checking the location log for files that are already present.
This can be a significant speedup when running in large trees that are only missing a few files; it makes copy --from just as fast as get.
-rw-r--r--Command/Move.hs22
-rw-r--r--debian/changelog2
2 files changed, 16 insertions, 8 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index f02f32558..9a6b0190e 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -110,14 +110,20 @@ toPerform dest move key = moveLock move key $ do
- from the remote.
-}
fromStart :: Remote.Remote Annex -> Bool -> FilePath -> CommandStart
-fromStart src move file = isAnnexed file $ \(key, _) -> do
- u <- getUUID
- remotes <- Remote.keyPossibilities key
- if u == Remote.uuid src || not (any (== src) remotes)
- then stop
- else do
- showMoveAction move file
- next $ fromPerform src move key
+fromStart src move file
+ | move == True = isAnnexed file $ \(key, _) -> go key
+ | otherwise = isAnnexed file $ \(key, _) -> do
+ ishere <- inAnnex key
+ if ishere then stop else go key
+ where
+ go key = do
+ u <- getUUID
+ remotes <- Remote.keyPossibilities key
+ if u == Remote.uuid src || not (any (== src) remotes)
+ then stop
+ else do
+ showMoveAction move file
+ next $ fromPerform src move key
fromPerform :: Remote.Remote Annex -> Bool -> Key -> CommandPerform
fromPerform src move key = moveLock move key $ do
ishere <- inAnnex key
diff --git a/debian/changelog b/debian/changelog
index 9fa96e06a..72110785b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ git-annex (3.20111108) UNRELEASED; urgency=low
* Handle a case where an annexed file is moved into a gitignored directory,
by having fix --force add its change.
* Avoid cyclic drop problems.
+ * Optimized copy --from and get --from to avoid checking the location log
+ for files that are already present.
-- Joey Hess <joeyh@debian.org> Mon, 07 Nov 2011 18:08:42 -0400