summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-29 12:30:50 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-29 12:30:50 +0000
commitab9bd1346af936085ad8d986ad17f87df374f272 (patch)
tree10e31cf7ba8b2b91a37df1390db98a3d5cc4a60a
parent3a92a2b1d13d54b431b1ff1de77329aa919f043c (diff)
downloadobnam-ab9bd1346af936085ad8d986ad17f87df374f272.tar.gz
Fix "obnam diff latest"
Add test case. Fix code. Reported-by: Junyx
-rw-r--r--obnamlib/plugins/show_plugin.py3
-rw-r--r--yarns/0040-generations.yarn6
-rw-r--r--yarns/9000-implements.yarn6
3 files changed, 14 insertions, 1 deletions
diff --git a/obnamlib/plugins/show_plugin.py b/obnamlib/plugins/show_plugin.py
index 9d5604cb..ab1f4be9 100644
--- a/obnamlib/plugins/show_plugin.py
+++ b/obnamlib/plugins/show_plugin.py
@@ -315,7 +315,8 @@ class ShowPlugin(obnamlib.ObnamPlugin):
self.open_repository()
client_name = self.app.settings['client-name']
if len(args) == 1:
- gen_id2 = self.repo.interpret_generation_spec(args[0])
+ gen_id2 = self.repo.interpret_generation_spec(
+ client_name, args[0])
# Now we have the dst/second generation for show_diff. Use
# genids/list_generations to find the previous generation
genids = self.repo.get_client_generation_ids(client_name)
diff --git a/yarns/0040-generations.yarn b/yarns/0040-generations.yarn
index 871adcb7..8339d9a0 100644
--- a/yarns/0040-generations.yarn
+++ b/yarns/0040-generations.yarn
@@ -88,6 +88,12 @@ generations are identical:
AND user U backs up directory L to repository R
AND user U diffs generations 1 and 2 in repository R into D
THEN file D is empty
+
+`obnam diff` can be used with just one generation, and that compares
+it with the generation preceding the given one.
+
+ WHEN user U diffs latest generation in repository R 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.
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index f2dab5f4..300112bb 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -400,6 +400,12 @@ unpredictable.
id2=$(run_obnam "$MATCH_1" -r "$DATADIR/$MATCH_4" genids | awk -v "n=$MATCH_3" 'NR == n')
run_obnam "$MATCH_1" diff -r "$DATADIR/$MATCH_4" "$id1" "$id2" > "$DATADIR/$MATCH_5"
+Show the diff between the latest generation and the generation before
+that.
+
+ IMPLEMENTS WHEN user (\S+) diffs latest generation in repository (\S+) into (\S+)
+ run_obnam "$MATCH_1" diff -r "$DATADIR/$MATCH_2" latest > "$DATADIR/$MATCH_3"
+
Encryption key management
-------------------------