From 589d1711f20a4eb83cadcdeee89120e05f150897 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 11 Oct 2012 18:39:21 -0400 Subject: [PATCH] git config remote.name.annex-sync can be used to control whether a remote gets synced. --- Command/Sync.hs | 4 +++- Config.hs | 5 +++++ debian/changelog | 2 ++ doc/git-annex.mdwn | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Command/Sync.hs b/Command/Sync.hs index 11ea30a52c..1795a61049 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -26,6 +26,7 @@ import Git.Types (BlobType(..)) import qualified Types.Remote import qualified Remote.Git import Types.Key +import Config import qualified Data.ByteString.Lazy as L import Data.Hash.MD5 @@ -71,7 +72,8 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted ) unwords (map Types.Remote.name s) return l available = filter (not . Remote.specialRemote) - <$> Remote.enabledRemoteList + <$> (filterM (repoSyncable . Types.Remote.repo) + =<< Remote.enabledRemoteList) good = filterM $ Remote.Git.repoAvail . Types.Remote.repo fastest = fromMaybe [] . headMaybe . Remote.byCost diff --git a/Config.hs b/Config.hs index 2c26adc736..04ab66507b 100644 --- a/Config.hs +++ b/Config.hs @@ -86,6 +86,11 @@ repoNotIgnored :: Git.Repo -> Annex Bool repoNotIgnored r = not . fromMaybe False . Git.Config.isTrue <$> 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 - in git config. forcenumcopies overrides everything. -} getNumCopies :: Maybe Int -> Annex Int diff --git a/debian/changelog b/debian/changelog index 5a8056cf6a..65e091753b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ git-annex (3.20121010) UNRELEASED; urgency=low * webapp: Improve wording of intro display. Closes: #689848 * webapp: Repositories can now be configured, to change their description, 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 Wed, 10 Oct 2012 12:59:25 -0400 diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index 2721cd22d8..c427cbfe7f 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -795,6 +795,11 @@ Here are all the supported configuration settings. Or, it could be used if the network connection between two repositories is too slow to be used normally. +* `remote..annex-sync` + + If set to `false`, prevents git-annex sync (and the git-annex assistant) + from syncing with this remote. + * `remote..annexUrl` Can be used to specify a different url than the regular `remote..url`