]> arthur.barton.de Git - bup.git/commitdiff
Adds -f option to save to use a given indexfile.
authorZoran Zaric <zz@zoranzaric.de>
Mon, 6 Dec 2010 12:00:08 +0000 (13:00 +0100)
committerAvery Pennarun <apenwarr@gmail.com>
Mon, 3 Jan 2011 04:57:31 +0000 (20:57 -0800)
index supported -f before but save didn't.  Using a specific indexfile
makes it possible to use temporary indexfiles for one-time-backups like
imports.

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Documentation/bup-save.md
cmd/save-cmd.py
t/test.sh

index 0d151912c3491c8ae79a270f020e168dc776ce0a..638e5019d2710204e1ffb6f8e9b3d9830dea27b2 100644 (file)
@@ -8,8 +8,8 @@ bup-save - create a new bup backup set
 
 # SYNOPSIS
 
-bup save [-r *host*:*path*] <-t|-c|-n *name*> [-v] [-q]
-  [--smaller=*maxsize*] <paths...>
+bup save [-r *host*:*path*] <-t|-c|-n *name*> [-f *indexfile*]
+[-v] [-q] [--smaller=*maxsize*] <paths...>
 
 # DESCRIPTION
 
@@ -45,6 +45,10 @@ for `bup-index`(1).
     the same name, and later view the history of that
     backup set to see how files have changed over time.)
     
+-f, --indexfile=*indexfile*
+:   use a different index filename instead of
+    `~/.bup/bupindex`.
+
 -v, --verbose
 :   increase verbosity (can be used more than once).  With
     one -v, prints every directory name as it gets backed up.  With
index d8c73cc711222fbf6195a59ed5389b949dd564fc..d278e70727a1b07e7b18b8a755a8d5378854325f 100755 (executable)
@@ -16,6 +16,7 @@ v,verbose  increase log output (can be used more than once)
 q,quiet    don't show progress meter
 smaller=   only back up files smaller than n bytes
 bwlimit=   maximum bytes/sec to transmit to server
+f,indexfile=  the name of the index file (normally BUP_DIR/bupindex)
 strip      strips the path to every filename given
 strip-path= path-prefix to be stripped when saving
 """
@@ -134,7 +135,9 @@ def vlog(s):
     log(s)
 
 
-r = index.Reader(git.repo('bupindex'))
+indexfile = opt.indexfile or git.repo('bupindex')
+print indexfile
+r = index.Reader(indexfile)
 
 def already_saved(ent):
     return ent.is_valid() and w.exists(ent.sha) and ent.sha
index a38eb5609c02a28765a42a2678682cd76f1b727f..048c5df0618fbbc3abef93b434eb053107f19372 100755 (executable)
--- a/t/test.sh
+++ b/t/test.sh
@@ -337,3 +337,24 @@ WVPASSEQ "$(bup ls strip-path/latest/$D/)" "a
 b
 d/
 f"
+
+WVSTART "indexfile"
+D=indexfile.tmp
+INDEXFILE=tmpindexfile.tmp
+rm -f $INDEXFILE
+rm -rf $D
+mkdir $D
+export BUP_DIR="$D/.bup"
+WVPASS bup init
+touch $D/a
+touch $D/b
+mkdir $D/c
+WVPASS bup index -ux $D
+bup save --strip -n bupdir $D
+WVPASSEQ "$(bup ls bupdir/latest/)" "a
+b
+c/"
+WVPASS bup index -f $INDEXFILE --exclude=$D/c -ux $D
+bup save --strip -n indexfile -f $INDEXFILE $D
+WVPASSEQ "$(bup ls indexfile/latest/)" "a
+b"