diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-03-17 08:12:27 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-03-17 08:12:27 +0000 |
commit | 4c6cbecc4b61f43e077adcc2be381817547adda1 (patch) | |
tree | d0779ef36d4c1d3a7fe0e96a6e7fcee509d2c531 | |
parent | 47b91d1f2a329646bb4bc759e20b23c6281b779e (diff) | |
download | obnam-4c6cbecc4b61f43e077adcc2be381817547adda1.tar.gz |
Convert forget --pretend cmdtest to yarn
-rwxr-xr-x | tests/forget-removes-nothing-if-pretending.script | 29 | ||||
-rw-r--r-- | yarns/0040-generations.yarn | 17 | ||||
-rw-r--r-- | yarns/9000-implements.yarn | 6 |
3 files changed, 23 insertions, 29 deletions
diff --git a/tests/forget-removes-nothing-if-pretending.script b/tests/forget-removes-nothing-if-pretending.script deleted file mode 100755 index 1780a41f..00000000 --- a/tests/forget-removes-nothing-if-pretending.script +++ /dev/null @@ -1,29 +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 - -echo aaa > "$DATADIR/data/aaa" -echo ccc > "$DATADIR/data/ccc" - -$SRCDIR/tests/backup -$SRCDIR/tests/backup - -$SRCDIR/tests/obnam genids > "$DATADIR/genids-1" -$SRCDIR/tests/obnam forget --pretend --keep=1d -$SRCDIR/tests/obnam genids > "$DATADIR/genids-2" -diff -u "$DATADIR/genids-1" "$DATADIR/genids-2" - diff --git a/yarns/0040-generations.yarn b/yarns/0040-generations.yarn index f3de0536..69bc4a03 100644 --- a/yarns/0040-generations.yarn +++ b/yarns/0040-generations.yarn @@ -157,3 +157,20 @@ The normal way of forgetting generations is with the `obnam forget THEN user U sees 1 generation in repository R WHEN user U restores their latest generation in repository R into X THEN L, restored to X, matches manifest M + +Dnn't really forget anything if pretending +------------------------------------------ + +The `--pretend` option prevents `obnam forget` from actually removing +anything, but lets the user see what would be removed. + + SCENARIO forget doesn't really, when pretending + GIVEN 1kB of new data in directory L + WHEN user U backs up directory L to repository R + GIVEN 1kB of new data in directory L + AND a manifest of L in M + WHEN user U backs up directory L to repository R + AND user U pretends to forget according to schedule 1y in repository R + THEN user U sees 2 generations in repository R + WHEN user U restores their latest generation in repository R into X + THEN L, restored to X, matches manifest M diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index b39976c2..2117f927 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -278,6 +278,12 @@ Remove according to a `--keep` schedule. IMPLEMENTS WHEN user (\S+) forgets according to schedule (\S+) in repository (\S+) run_obnam "$MATCH_1" forget -r "$DATADIR/$MATCH_3" --keep "$MATCH_2" +Pretend to forget. + + IMPLEMENTS WHEN user (\S+) pretends to forget according to schedule (\S+) in repository (\S+) + run_obnam "$MATCH_1" \ + forget --pretend -r "$DATADIR/$MATCH_3" --keep "$MATCH_2" + List generations ---------------- |