Sped up some operations on remotes that are on the same host.
Specifically, disabled trying to update the git-annex branch on the remote, since that data is never used by operations that act on such remotes. Also, when copying content to such a remote, skip committing the presence information changes to its git-annex branch. Leaving it in the journal there is ok: Any command run on the remote that needs the info will flush the journal. This may partially solve this bug: http://git-annex.branchable.com/bugs/fails_to_handle_lot_of_files/ Although I still see unreaped git processes piling up when doing a copy --to.
This commit is contained in:
parent
2eefc58070
commit
373cad993d
3 changed files with 25 additions and 9 deletions
|
@ -8,6 +8,7 @@
|
||||||
module Annex.Branch (
|
module Annex.Branch (
|
||||||
create,
|
create,
|
||||||
update,
|
update,
|
||||||
|
disableUpdate,
|
||||||
get,
|
get,
|
||||||
change,
|
change,
|
||||||
commit,
|
commit,
|
||||||
|
@ -136,7 +137,7 @@ update = onceonly $ do
|
||||||
c <- filterM changedbranch =<< siblingBranches
|
c <- filterM changedbranch =<< siblingBranches
|
||||||
let (refs, branches) = unzip c
|
let (refs, branches) = unzip c
|
||||||
unless (not dirty && null refs) $ withIndex $ lockJournal $ do
|
unless (not dirty && null refs) $ withIndex $ lockJournal $ do
|
||||||
when dirty $ stageJournalFiles
|
when dirty stageJournalFiles
|
||||||
g <- gitRepo
|
g <- gitRepo
|
||||||
unless (null branches) $ do
|
unless (null branches) $ do
|
||||||
showSideAction $ "merging " ++
|
showSideAction $ "merging " ++
|
||||||
|
@ -164,8 +165,15 @@ update = onceonly $ do
|
||||||
return $ not $ L.null diffs
|
return $ not $ L.null diffs
|
||||||
onceonly a = unlessM (branchUpdated <$> getState) $ do
|
onceonly a = unlessM (branchUpdated <$> getState) $ do
|
||||||
r <- a
|
r <- a
|
||||||
Annex.changeState setupdated
|
disableUpdate
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
{- Avoids updating the branch. A useful optimisation when the branc
|
||||||
|
- is known to have not changed, or git-annex won't be relying on info
|
||||||
|
- from it. -}
|
||||||
|
disableUpdate :: Annex ()
|
||||||
|
disableUpdate = Annex.changeState setupdated
|
||||||
|
where
|
||||||
setupdated s = s { Annex.branchstate = new }
|
setupdated s = s { Annex.branchstate = new }
|
||||||
where
|
where
|
||||||
new = old { branchUpdated = True }
|
new = old { branchUpdated = True }
|
||||||
|
|
|
@ -19,6 +19,7 @@ import qualified Git
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
import qualified Annex.Content
|
import qualified Annex.Content
|
||||||
|
import qualified Annex.Branch
|
||||||
import qualified Utility.Url as Url
|
import qualified Utility.Url as Url
|
||||||
import Utility.TempFile
|
import Utility.TempFile
|
||||||
import Config
|
import Config
|
||||||
|
@ -133,7 +134,7 @@ inAnnex r key
|
||||||
| Git.repoIsUrl r = checkremote
|
| Git.repoIsUrl r = checkremote
|
||||||
| otherwise = safely checklocal
|
| otherwise = safely checklocal
|
||||||
where
|
where
|
||||||
checklocal = onLocal r (Annex.Content.inAnnex key)
|
checklocal = onLocal r $ Annex.Content.inAnnex key
|
||||||
checkremote = do
|
checkremote = do
|
||||||
showAction $ "checking " ++ Git.repoDescribe r
|
showAction $ "checking " ++ Git.repoDescribe r
|
||||||
inannex <- onRemote r (boolSystem, False) "inannex"
|
inannex <- onRemote r (boolSystem, False) "inannex"
|
||||||
|
@ -147,7 +148,11 @@ inAnnex r key
|
||||||
onLocal :: Git.Repo -> Annex a -> IO a
|
onLocal :: Git.Repo -> Annex a -> IO a
|
||||||
onLocal r a = do
|
onLocal r a = do
|
||||||
annex <- Annex.new r
|
annex <- Annex.new r
|
||||||
Annex.eval annex a
|
Annex.eval annex $ do
|
||||||
|
-- No need to update the branch; its data is not used
|
||||||
|
-- for anything onLocal is used to do.
|
||||||
|
Annex.Branch.disableUpdate
|
||||||
|
a
|
||||||
|
|
||||||
keyUrl :: Git.Repo -> Key -> String
|
keyUrl :: Git.Repo -> Key -> String
|
||||||
keyUrl r key = Git.repoLocation r ++ "/" ++ annexLocation key
|
keyUrl r key = Git.repoLocation r ++ "/" ++ annexLocation key
|
||||||
|
@ -175,11 +180,8 @@ copyToRemote r key
|
||||||
g <- gitRepo
|
g <- gitRepo
|
||||||
let keysrc = gitAnnexLocation g key
|
let keysrc = gitAnnexLocation g key
|
||||||
-- run copy from perspective of remote
|
-- run copy from perspective of remote
|
||||||
liftIO $ onLocal r $ do
|
liftIO $ onLocal r $ Annex.Content.getViaTmp key $
|
||||||
ok <- Annex.Content.getViaTmp key $
|
rsyncOrCopyFile r keysrc
|
||||||
rsyncOrCopyFile r keysrc
|
|
||||||
Annex.Content.saveState
|
|
||||||
return ok
|
|
||||||
| Git.repoIsSsh r = do
|
| Git.repoIsSsh r = do
|
||||||
g <- gitRepo
|
g <- gitRepo
|
||||||
let keysrc = gitAnnexLocation g key
|
let keysrc = gitAnnexLocation g key
|
||||||
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
||||||
|
git-annex (3.20111026) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* Sped up some operations on remotes that are on the same host.
|
||||||
|
|
||||||
|
-- Joey Hess <joeyh@debian.org> Thu, 27 Oct 2011 13:58:53 -0400
|
||||||
|
|
||||||
git-annex (3.20111025) unstable; urgency=low
|
git-annex (3.20111025) unstable; urgency=low
|
||||||
|
|
||||||
* A remote can have a annexUrl configured, that is used by git-annex
|
* A remote can have a annexUrl configured, that is used by git-annex
|
||||||
|
|
Loading…
Add table
Reference in a new issue