summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/restores-single-file.script26
-rw-r--r--yarns/0030-basics.yarn14
-rw-r--r--yarns/9000-implements.yarn8
3 files changed, 22 insertions, 26 deletions
diff --git a/tests/restores-single-file.script b/tests/restores-single-file.script
deleted file mode 100755
index 748d3113..00000000
--- a/tests/restores-single-file.script
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-# Copyright 2011 Lars Wirzenius
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-set -e
-
-# Create a file in the test data with a name and contents we know.
-echo foobar > "$DATADIR/data/foo"
-
-$SRCDIR/tests/backup
-$SRCDIR/tests/restore "$DATADIR/data/foo"
-
-# Verify it's OK.
-diff "$DATADIR/data/foo" "$DATADIR/restored/$DATADIR/data/foo"
diff --git a/yarns/0030-basics.yarn b/yarns/0030-basics.yarn
index e7492297..a2ae12fa 100644
--- a/yarns/0030-basics.yarn
+++ b/yarns/0030-basics.yarn
@@ -114,6 +114,20 @@ backup, if the backup finishes successfully.
WHEN user U backs up directory L to repository R
THEN user U sees no checkpoint generations in repository R
+Restore a single file
+---------------------
+
+We need to be able to restore only a single file.
+
+ SCENARIO restore a single file
+ GIVEN a file F in L, with data
+ AND a manifest of directory L in M
+ AND 100kB of new data in directory L
+ AND manifest M has Mtime for the first entry set from L
+ WHEN user U backs up directory L to repository R
+ AND user U restores file L/F to X from their latest generation in repository R
+ THEN L, restored to X, matches manifest M
+
Pretend backing up: the `--pretend` setting
-------------------------------------------
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn
index ccead253..65a6f2f3 100644
--- a/yarns/9000-implements.yarn
+++ b/yarns/9000-implements.yarn
@@ -216,6 +216,14 @@ to fail.
attempt run_obnam "$MATCH_1" restore -r "$DATADIR/$MATCH_2" \
--to "$DATADIR/$MATCH_3"
+We may need to restore only a single file.
+
+ IMPLEMENTS WHEN user (\S+) restores file (\S+) to (\S+) from their latest generation in repository (\S+)
+ run_obnam "$MATCH_1" ls -r "$DATADIR/$MATCH_4"
+ run_obnam "$MATCH_1" restore -r "$DATADIR/$MATCH_4" \
+ --to "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_2"
+
+
Removing (forgetting) generations
---------------------------------