From 79f10b75c16f0fda9bbff2a286ffdf229c755ecc Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Sat, 16 Mar 2013 11:17:53 -0400
Subject: [PATCH] Add incrementalbackup repository group.

---
 Types/StandardGroups.hs                  |  6 +++++-
 debian/changelog                         |  1 +
 doc/preferred_content.mdwn               |  9 ++++++++-
 templates/documentation/repogroup.hamlet | 11 ++++++++---
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/Types/StandardGroups.hs b/Types/StandardGroups.hs
index a8ac89b4ec..065811442c 100644
--- a/Types/StandardGroups.hs
+++ b/Types/StandardGroups.hs
@@ -21,6 +21,7 @@ fromStandardGroup :: StandardGroup -> String
 fromStandardGroup ClientGroup = "client"
 fromStandardGroup TransferGroup = "transfer"
 fromStandardGroup BackupGroup = "backup"
+fromStandardGroup IncrementalBackupGroup = "incrementalbackup"
 fromStandardGroup SmallArchiveGroup = "smallarchive"
 fromStandardGroup FullArchiveGroup = "archive"
 fromStandardGroup SourceGroup = "source"
@@ -30,6 +31,7 @@ toStandardGroup :: String -> Maybe StandardGroup
 toStandardGroup "client" = Just ClientGroup
 toStandardGroup "transfer" = Just TransferGroup
 toStandardGroup "backup" = Just BackupGroup
+toStandardGroup "incrementalbackup" = Just IncrementalBackupGroup
 toStandardGroup "smallarchive" = Just SmallArchiveGroup
 toStandardGroup "archive" = Just FullArchiveGroup
 toStandardGroup "source" = Just SourceGroup
@@ -39,7 +41,8 @@ toStandardGroup _ = Nothing
 descStandardGroup :: StandardGroup -> String
 descStandardGroup ClientGroup = "client: a repository on your computer"
 descStandardGroup TransferGroup = "transfer: distributes files to clients"
-descStandardGroup BackupGroup = "backup: backs up all files"
+descStandardGroup BackupGroup = "full backup: backs up all files"
+descStandardGroup IncrementalBackupGroup = "incremental backup: backs up files not backed up elsewhere"
 descStandardGroup SmallArchiveGroup = "small archive: archives files located in \"archive\" directories"
 descStandardGroup FullArchiveGroup = "full archive: archives all files not archived elsewhere"
 descStandardGroup SourceGroup = "file source: moves files on to other repositories"
@@ -50,6 +53,7 @@ preferredContent :: StandardGroup -> String
 preferredContent ClientGroup = "exclude=*/archive/* and exclude=archive/*"
 preferredContent TransferGroup = "not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup
 preferredContent BackupGroup = "include=*"
+preferredContent IncrementalBackupGroup = "include=* and (not copies=incrementalbackup:1)"
 preferredContent SmallArchiveGroup = "(include=*/archive/* or include=archive/*) and " ++ preferredContent FullArchiveGroup
 preferredContent FullArchiveGroup = "not (copies=archive:1 or copies=smallarchive:1)"
 preferredContent SourceGroup = "not (copies=1)"
diff --git a/debian/changelog b/debian/changelog
index 2300de0d64..75010c9c6f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ git-annex (4.20130315) UNRELEASED; urgency=low
   * webapp: Improved UI for pairing your own devices together using XMPP.
   * webapp: Display an alert when there are XMPP remotes, and a cloud
     transfer repository needs to be configured.
+  * Add incrementalbackup repository group.
 
  -- Joey Hess <joeyh@debian.org>  Fri, 15 Mar 2013 00:10:07 -0400
 
diff --git a/doc/preferred_content.mdwn b/doc/preferred_content.mdwn
index 1d7fc6bc80..763e348f19 100644
--- a/doc/preferred_content.mdwn
+++ b/doc/preferred_content.mdwn
@@ -56,7 +56,7 @@ dropped. If the content would not be preferred then, the drop can be done.
 So, for example, `copies=2` in a preferred content expression lets
 content be dropped only when there are currently 3 copies of it, including
 the repo it's being dropped from. This is different than running `git annex
-drop --copies=2`, which will drop files that current have 2 copies.
+drop --copies=2`, which will drop files that currently have 2 copies.
 
 ### difference: "present"
 
@@ -109,6 +109,13 @@ All content is preferred.
 
 `include=*`
 
+### incremental backup
+
+Only prefers content that's not already backed up to another backup
+or incremental backup repository.
+
+`include=* and (not copies=backup:1) and (not copies=incrementalbackup:1)`
+
 ### small archive
 
 Only prefers content that's located in an "archive" directory, and
diff --git a/templates/documentation/repogroup.hamlet b/templates/documentation/repogroup.hamlet
index 50913ca949..0b04b6a6eb 100644
--- a/templates/documentation/repogroup.hamlet
+++ b/templates/documentation/repogroup.hamlet
@@ -19,9 +19,14 @@
     hold the files that need to be synced to other repositories, so they #
     are relatively small.
   <p>
-    You can get along without any <b>backup repositories</b>, but they're #
-    a useful safeguard. These repositories accumulate every file they can #
-    get ahold of. A large removable drive makes a good backup repository.
+    You can get along without any <b>full backup repositories</b>, but #
+    they're a useful safeguard. These repositories accumulate every file
+    they can get ahold of. A large removable drive makes a good full backup #
+    repository.
+  <p>
+    Similarly, the <b>incremental backup repositories</b> try to back up #
+    every file, but these only accumulate files that are not already #
+    present in a full or incremental backup.
   <p>
     Next we come to the <b>archive repositories</b>.
     The archive repositories coordinate together, so that each file is #