git config remote.name.annex-sync can be used to control whether a remote gets synced.

This commit is contained in:
Joey Hess 2012-10-11 18:39:21 -04:00
parent 1591245f88
commit 589d1711f2
4 changed files with 15 additions and 1 deletions

View file

@ -26,6 +26,7 @@ import Git.Types (BlobType(..))
import qualified Types.Remote import qualified Types.Remote
import qualified Remote.Git import qualified Remote.Git
import Types.Key import Types.Key
import Config
import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy as L
import Data.Hash.MD5 import Data.Hash.MD5
@ -71,7 +72,8 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted )
unwords (map Types.Remote.name s) unwords (map Types.Remote.name s)
return l return l
available = filter (not . Remote.specialRemote) available = filter (not . Remote.specialRemote)
<$> Remote.enabledRemoteList <$> (filterM (repoSyncable . Types.Remote.repo)
=<< Remote.enabledRemoteList)
good = filterM $ Remote.Git.repoAvail . Types.Remote.repo good = filterM $ Remote.Git.repoAvail . Types.Remote.repo
fastest = fromMaybe [] . headMaybe . Remote.byCost fastest = fromMaybe [] . headMaybe . Remote.byCost

View file

@ -86,6 +86,11 @@ repoNotIgnored :: Git.Repo -> Annex Bool
repoNotIgnored r = not . fromMaybe False . Git.Config.isTrue repoNotIgnored r = not . fromMaybe False . Git.Config.isTrue
<$> getRemoteConfig r "ignore" "" <$> getRemoteConfig r "ignore" ""
{- Checks if a repo should be synced. -}
repoSyncable :: Git.Repo -> Annex Bool
repoSyncable r = fromMaybe True . Git.Config.isTrue
<$> getRemoteConfig r "sync" ""
{- If a value is specified, it is used; otherwise the default is looked up {- If a value is specified, it is used; otherwise the default is looked up
- in git config. forcenumcopies overrides everything. -} - in git config. forcenumcopies overrides everything. -}
getNumCopies :: Maybe Int -> Annex Int getNumCopies :: Maybe Int -> Annex Int

2
debian/changelog vendored
View file

@ -11,6 +11,8 @@ git-annex (3.20121010) UNRELEASED; urgency=low
* webapp: Improve wording of intro display. Closes: #689848 * webapp: Improve wording of intro display. Closes: #689848
* webapp: Repositories can now be configured, to change their description, * webapp: Repositories can now be configured, to change their description,
their group, or even to disable syncing to them. their group, or even to disable syncing to them.
* git config remote.name.annex-sync can be used to control whether
a remote gets synced.
-- Joey Hess <joeyh@debian.org> Wed, 10 Oct 2012 12:59:25 -0400 -- Joey Hess <joeyh@debian.org> Wed, 10 Oct 2012 12:59:25 -0400

View file

@ -795,6 +795,11 @@ Here are all the supported configuration settings.
Or, it could be used if the network connection between two Or, it could be used if the network connection between two
repositories is too slow to be used normally. repositories is too slow to be used normally.
* `remote.<name>.annex-sync`
If set to `false`, prevents git-annex sync (and the git-annex assistant)
from syncing with this remote.
* `remote.<name>.annexUrl` * `remote.<name>.annexUrl`
Can be used to specify a different url than the regular `remote.<name>.url` Can be used to specify a different url than the regular `remote.<name>.url`