assistant: Fix syncing local drives.

Amoung other things, this makes it immediately sync files from a removable
drive when it's added.
This commit is contained in:
Joey Hess 2012-10-30 19:33:27 -04:00
parent 60fba9097a
commit 7fe1baf3f1
2 changed files with 16 additions and 12 deletions

View file

@ -43,18 +43,21 @@ reconnectRemotes notifypushes rs = void $ do
=<< liftAnnex (inRepo Git.Branch.current) =<< liftAnnex (inRepo Git.Branch.current)
addScanRemotes diverged rs addScanRemotes diverged rs
return ok return ok
where where
(gitremotes, _specialremotes) = gitremotes = filter (notspecialremote . Remote.repo) rs
partition (Git.repoIsUrl . Remote.repo) rs notspecialremote r
sync (Just branch) = do | Git.repoIsUrl r = True
diverged <- snd <$> manualPull (Just branch) gitremotes | Git.repoIsLocal r = True
now <- liftIO getCurrentTime | otherwise = False
ok <- pushToRemotes now notifypushes gitremotes sync (Just branch) = do
return (ok, diverged) diverged <- snd <$> manualPull (Just branch) gitremotes
{- No local branch exists yet, but we can try pulling. -} now <- liftIO getCurrentTime
sync Nothing = do ok <- pushToRemotes now notifypushes gitremotes
diverged <- snd <$> manualPull Nothing gitremotes return (ok, diverged)
return (True, diverged) {- No local branch exists yet, but we can try pulling. -}
sync Nothing = do
diverged <- snd <$> manualPull Nothing gitremotes
return (True, diverged)
{- Updates the local sync branch, then pushes it to all remotes, in {- Updates the local sync branch, then pushes it to all remotes, in
- parallel, along with the git-annex branch. This is the same - parallel, along with the git-annex branch. This is the same

1
debian/changelog vendored
View file

@ -34,6 +34,7 @@ git-annex (3.20121018) UNRELEASED; urgency=low
* The standalone tarball's runshell now takes care of installing a * The standalone tarball's runshell now takes care of installing a
~/.ssh/git-annex-shell wrapper the first time it's run. ~/.ssh/git-annex-shell wrapper the first time it's run.
* webapp: Make an initial, empty commit so there is a master branch * webapp: Make an initial, empty commit so there is a master branch
* assistant: Fix syncing local drives.
-- Joey Hess <joeyh@debian.org> Wed, 17 Oct 2012 14:24:10 -0400 -- Joey Hess <joeyh@debian.org> Wed, 17 Oct 2012 14:24:10 -0400