]> arthur.barton.de Git - bup.git/commitdiff
Add restore option "--exclude-rx-from FILE".
authorRob Browning <rlb@defaultvalue.org>
Fri, 20 Dec 2013 23:43:08 +0000 (17:43 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 21 Dec 2013 01:12:00 +0000 (19:12 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Documentation/bup-restore.md
cmd/restore-cmd.py
t/test-save-restore-exclude-rx.sh

index eb720b3420c358ee842899c7f291ef47428c9cbe..e57ecac6b4ccf0d320ab741f29964dde7af6cfb6 100644 (file)
@@ -8,8 +8,8 @@ bup-restore - extract files from a backup set
 
 # SYNOPSIS
 
-bup restore [\--outdir=*outdir*] [\--exclude-rx *pattern*] [-v] [-q]
-\<paths...\>
+bup restore [\--outdir=*outdir*] [\--exclude-rx *pattern*]
+[\--exclude-rx-from *filename*] [-v] [-q] \<paths...\>
 
 # DESCRIPTION
 
@@ -117,6 +117,10 @@ See the EXAMPLES section for a demonstration.
       * '/foo/.' - exclude the content of any directory named foo
       * '^/tmp/.' - exclude root-level /tmp's content, but not /tmp itself
 
+\--exclude-rx-from=*filename*
+:   read --exclude-rx patterns from *filename*, one pattern per-line
+    (may be repeated).
+
 \--map-user *old*=*new*
 :   for every path, restore the *old* (saved) user name as *new*.
     Specifying "" for *new* will clear the user.  For example
index 59cdc73956fe29de7485f69cce640660a25dc1a7..db6def75989bbe970524b8e4b1b86071160c9150 100755 (executable)
@@ -8,7 +8,8 @@ bup restore [-C outdir] </branch/revision/path/to/dir ...>
 --
 C,outdir=   change to given outdir before extracting files
 numeric-ids restore numeric IDs (user, group, etc.) rather than names
-exclude-rx= skip paths that match the unanchored regular expression
+exclude-rx= skip paths matching the unanchored regex (may be repeated)
+exclude-rx-from= skip --exclude-rx patterns in file (may be repeated)
 v,verbose   increase log output (can be used more than once)
 map-user=   given OLD=NEW, restore OLD user as NEW user
 map-group=  given OLD=NEW, restore OLD group as NEW group
index d5a4839ae0a4feac178b25810efa9a6b79491bee..e0f13e6f7d51726d66f74f17576c9a34cdd83569 100755 (executable)
@@ -211,4 +211,29 @@ WVPASSEQ "$actual" ".
 ./sub/foo"
 
 
+# bup restore --exclude-rx-from ...
+# =================================
+
+WVSTART "restore --exclude-rx-from"
+WVPASS rm -rf src "$BUP_DIR" buprestore.tmp
+WVPASS bup init
+WVPASS mkdir src
+WVPASS touch src/a
+WVPASS touch src/b
+WVPASS mkdir src/sub1
+WVPASS mkdir src/sub2
+WVPASS touch src/sub1/a
+WVPASS touch src/sub2/b
+WVPASS bup index -u src
+WVPASS bup save --strip -n bupdir src
+WVPASS echo "^/sub1/" > exclude-rx-file
+WVPASS bup restore -C buprestore.tmp \
+    --exclude-rx-from exclude-rx-file /bupdir/latest/
+actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+WVPASSEQ "$actual" ".
+./a
+./b
+./sub2
+./sub2/b"
+
 WVPASS rm -rf "$tmpdir"