summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-22 14:57:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-22 14:57:09 -0400
commit8655ea7f8e853b7de4defbca2655b741362ecd21 (patch)
tree685b461a9e6471dbf403bb281d4382661a36d245
parent032c802d45c7872f704de1faf0733740b256444d (diff)
sync, assistant: Sync with remotes that have annex-ignore set
This is so git remotes on servers without git-annex installed can be used to keep clients' git repos in sync. This is a behavior change, but since annex-sync can be set to disable syncing with a remote, I think it's acceptable.
-rw-r--r--Assistant/DaemonStatus.hs9
-rw-r--r--Assistant/Sync.hs4
-rw-r--r--Assistant/Threads/MountWatcher.hs2
-rw-r--r--Assistant/Threads/NetWatcher.hs2
-rw-r--r--Command/Sync.hs2
-rw-r--r--Remote.hs4
-rw-r--r--Remote/List.hs4
-rw-r--r--debian/changelog3
-rw-r--r--doc/git-annex.mdwn7
9 files changed, 21 insertions, 16 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs
index c966fc93a..f94521117 100644
--- a/Assistant/DaemonStatus.hs
+++ b/Assistant/DaemonStatus.hs
@@ -48,18 +48,19 @@ modifyDaemonStatus a = do
calcSyncRemotes :: Annex (DaemonStatus -> DaemonStatus)
calcSyncRemotes = do
rs <- filter (remoteAnnexSync . Remote.gitconfig) .
- concat . Remote.byCost <$> Remote.enabledRemoteList
+ concat . Remote.byCost <$> Remote.remoteList
alive <- trustExclude DeadTrusted (map Remote.uuid rs)
let good r = Remote.uuid r `elem` alive
let syncable = filter good rs
- let nonxmpp = filter (not . isXMPPRemote) syncable
+ let syncdata = filter (not . remoteAnnexIgnore . Remote.gitconfig) $
+ filter (not . isXMPPRemote) syncable
return $ \dstatus -> dstatus
{ syncRemotes = syncable
, syncGitRemotes =
filter (not . Remote.specialRemote) syncable
- , syncDataRemotes = nonxmpp
- , syncingToCloudRemote = any iscloud nonxmpp
+ , syncDataRemotes = syncdata
+ , syncingToCloudRemote = any iscloud syncdata
}
where
iscloud r = not (Remote.readonly r) && Remote.globallyAvailable r
diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs
index 78fdbab1a..727749c4f 100644
--- a/Assistant/Sync.hs
+++ b/Assistant/Sync.hs
@@ -68,7 +68,9 @@ reconnectRemotes notifypushes rs = void $ do
go = do
(failed, diverged) <- sync
=<< liftAnnex (inRepo Git.Branch.current)
- addScanRemotes diverged nonxmppremotes
+ addScanRemotes diverged $
+ filter (not . remoteAnnexIgnore . Remote.gitconfig)
+ nonxmppremotes
return failed
{- Updates the local sync branch, then pushes it to all remotes, in
diff --git a/Assistant/Threads/MountWatcher.hs b/Assistant/Threads/MountWatcher.hs
index c03eac4f1..143ae9cee 100644
--- a/Assistant/Threads/MountWatcher.hs
+++ b/Assistant/Threads/MountWatcher.hs
@@ -157,7 +157,7 @@ handleMount :: FilePath -> Assistant ()
handleMount dir = do
debug ["detected mount of", dir]
rs <- filter (Git.repoIsLocal . Remote.repo) <$> remotesUnder dir
- reconnectRemotes True $ filter (not . remoteAnnexIgnore . Remote.gitconfig) rs
+ reconnectRemotes True rs
{- Finds remotes located underneath the mount point.
-
diff --git a/Assistant/Threads/NetWatcher.hs b/Assistant/Threads/NetWatcher.hs
index 6d15d414e..6ac7203b0 100644
--- a/Assistant/Threads/NetWatcher.hs
+++ b/Assistant/Threads/NetWatcher.hs
@@ -128,4 +128,4 @@ handleConnection = reconnectRemotes True =<< networkRemotes
{- Finds network remotes. -}
networkRemotes :: Assistant [Remote]
networkRemotes = liftAnnex $
- filter (isNothing . Remote.localpath) <$> enabledRemoteList
+ filter (isNothing . Remote.localpath) <$> remoteList
diff --git a/Command/Sync.hs b/Command/Sync.hs
index a25f6a602..0a8ed7827 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -73,7 +73,7 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted )
return l
available = filter (not . Remote.specialRemote)
. filter (remoteAnnexSync . Types.Remote.gitconfig)
- <$> Remote.enabledRemoteList
+ <$> Remote.remoteList
good = filterM $ Remote.Git.repoAvail . Types.Remote.repo
fastest = fromMaybe [] . headMaybe . Remote.byCost
diff --git a/Remote.hs b/Remote.hs
index 27e69a5a0..e722542a8 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -19,7 +19,6 @@ module Remote (
remoteTypes,
remoteList,
- enabledRemoteList,
specialRemote,
remoteMap,
uuidDescriptions,
@@ -211,7 +210,8 @@ keyPossibilities' key trusted = do
let validtrusteduuids = validuuids `intersect` trusted
-- remotes that match uuids that have the key
- allremotes <- enabledRemoteList
+ allremotes <- filter (not . remoteAnnexIgnore . gitconfig)
+ <$> remoteList
let validremotes = remotesWithUUID allremotes validuuids
return (sortBy (comparing cost) validremotes, validtrusteduuids)
diff --git a/Remote/List.hs b/Remote/List.hs
index 1cfbab872..0651d83aa 100644
--- a/Remote/List.hs
+++ b/Remote/List.hs
@@ -98,10 +98,6 @@ updateRemote remote = do
Remote.Git.configRead r
| otherwise = return r
-{- All remotes that are not ignored. -}
-enabledRemoteList :: Annex [Remote]
-enabledRemoteList = filter (not . remoteAnnexIgnore . gitconfig) <$> remoteList
-
{- Checks if a remote is a special remote -}
specialRemote :: Remote -> Bool
specialRemote r = remotetype r /= Remote.Git.remote
diff --git a/debian/changelog b/debian/changelog
index e11d5ab88..86500c6f8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ git-annex (4.20130418) UNRELEASED; urgency=low
* webapp: Don't default to making repository in cwd when started
from within a directory containing a git-annex file (eg, standalone
tarball directory).
+ * sync, assistant: Sync with remotes that have annex-ignore set,
+ so that git remotes on servers without git-annex installed can be used
+ to keep clients' git repos in sync.
-- Joey Hess <joeyh@debian.org> Thu, 18 Apr 2013 16:22:48 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index b9badce9b..1c2247654 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -904,14 +904,17 @@ Here are all the supported configuration settings.
* `remote.<name>.annex-ignore`
If set to `true`, prevents git-annex
- from using this remote by default. (You can still request it be used
- by the --from and --to options.)
+ from storing file contents on this remote by default.
+ (You can still request it be used by the --from and --to options.)
This is, for example, useful if the remote is located somewhere
without git-annex-shell. (For example, if it's on GitHub).
Or, it could be used if the network connection between two
repositories is too slow to be used normally.
+ This does not prevent git-annex sync (or the git-annex assistant) from
+ syncing the git repository to the remote.
+
* `remote.<name>.annex-sync`
If set to `false`, prevents git-annex sync (and the git-annex assistant)