diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-11-24 00:21:50 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-11-24 00:21:50 +0000 |
commit | 33ebc912eaf524abbb30952ab8a601502ed53674 (patch) | |
tree | 02d99e6318bca4d13c2614531a2b0f6f8f038456 /rdiff-backup/rdiff_backup/Main.py | |
parent | 8c16d0e2c767afb0d67fdf05a687197e4370f82f (diff) | |
download | rdiff-backup-33ebc912eaf524abbb30952ab8a601502ed53674.tar.gz |
Added restore selection file fix
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@500 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/Main.py')
-rw-r--r-- | rdiff-backup/rdiff_backup/Main.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index 5eae9bf..ad0440c 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -20,7 +20,7 @@ """Start (and end) here - read arguments, set global settings, etc.""" from __future__ import generators -import getopt, sys, re, os +import getopt, sys, re, os, cStringIO from log import Log, LoggerError, ErrorLog import Globals, Time, SetConnections, selection, robust, rpath, \ manage, backup, connection, restore, FilenameMapping, \ @@ -408,16 +408,26 @@ def restore_common(rpin, target, time): Log("Restore ended", 4) def restore_set_select(mirror_rp, target): - """Set the selection iterator on mirror side from command line args + """Set the selection iterator on both side from command line args - Here we set the selector on the mirror side, because that is where - we will be filtering, but the pathnames are relative to the target - directory. + We must set both sides because restore filtering is different from + select filtering. For instance, if a file is excluded it should + not be deleted from the target directory. + + The StringIO stuff is because filelists need to be read and then + duplicated, because we need two copies of them now. """ + def fp2string(fp): + buf = fp.read() + assert not fp.close() + return buf + select_data = map(fp2string, select_files) if select_opts: mirror_rp.conn.restore.MirrorStruct.set_mirror_select( - target, select_opts, *select_files) + target, select_opts, *map(cStringIO.StringIO, select_data)) + target.conn.restore.TargetStruct.set_target_select( + target, select_opts, *map(cStringIO.StringIO, select_data)) def restore_start_log(rpin, target, time): """Open restore log file, log initial message""" |