summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yarns/0040-generations.yarn22
-rw-r--r--yarns/9000-implements.yarn22
2 files changed, 43 insertions, 1 deletions
diff --git a/yarns/0040-generations.yarn b/yarns/0040-generations.yarn
index d592faca..a5ac5fa2 100644
--- a/yarns/0040-generations.yarn
+++ b/yarns/0040-generations.yarn
@@ -78,7 +78,27 @@ line for that.
Comparing generations (`obnam diff`)
------------------------------------
-FIXME.
+Once we've backed up two generations, we need to be able to see the
+difference. First of all, the diff should be empty when the
+generations are identical:
+
+ SCENARIO diff identical generations
+ GIVEN 1K of new data in directory L
+ WHEN user backs up directory L
+ AND user backs up directory L
+ AND user diffs generations 1 and 2 into D
+ THEN file D is empty
+
+If we make a change to the data, that should be reflected in the diff.
+We'll assume the diff works, we'll just check whether it's empty.
+
+ SCENARIO diff modified generations
+ GIVEN 1K of new data in directory L
+ WHEN user backs up directory L
+ GIVEN 1K of new data in directory L
+ WHEN user backs up directory L
+ AND user diffs generations 1 and 2 into D
+ THEN file D is not empty
Forgetting a specific generation (`obnam forget`)
--------------------------------
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index d46885d3..956e8df5 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -140,9 +140,31 @@ Ditto for generation ids.
n=$(wc -l < "$DATADIR/generation-id.list")
test "$MATCH_1" = "$n"
+Diffs between generations
+-------------------------
+
+Compute the difference between two generations. The generations are
+identified by the ordinal, not generation id, since the ids are
+unpredictable.
+
+ IMPLEMENTS WHEN user diffs generations (\d+) and (\d+) into (\S+)
+ id1=$(run_obnam -r "$REPO" genids | awk -v "n=$MATCH_1" 'NR == n')
+ id2=$(run_obnam -r "$REPO" genids | awk -v "n=$MATCH_2" 'NR == n')
+ run_obnam diff -r "$REPO" "$id1" "$id2" > "$DATADIR/$MATCH_3"
+
Checks on files
---------------
+Is a file empty?
+
+ IMPLEMENTS THEN file (\S+) is empty
+ diff -u /dev/null "$DATADIR/$MATCH_1"
+
+Is a file not empty?
+
+ IMPLEMENTS THEN file (\S+) is not empty
+ ! diff -u /dev/null "$DATADIR/$MATCH_1"
+
Check that a restored file uses at most as much disk space as the
original one in live data.