diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-11-24 00:01:54 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-11-24 00:01:54 +0000 |
commit | b17688b2c85a77e4f4eb45a928e915f8004b81a2 (patch) | |
tree | 267bf09d16a31d3557426d012d14454f676b0e0e /rdiff-backup/rdiff_backup/Main.py | |
parent | a326e28f5c73d5334abc4759dad12249cbcb7cf0 (diff) | |
download | rdiff-backup-b17688b2c85a77e4f4eb45a928e915f8004b81a2.tar.gz |
Restore excludes now leave existing files on target alone
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@497 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 8cb817b..ef8440f 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, \ @@ -501,16 +501,26 @@ def restore_set_fs_globals(target): else: SetConnections.UpdateGlobal('chars_to_quote', "") 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""" |