summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/selection.py
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-30 23:33:17 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-30 23:33:17 +0000
commitb3c458f96706b7a6ef570434c9c9adc7129912a4 (patch)
tree147d094408050f337c1ac9b752f61e3be7a23bda /rdiff-backup/rdiff_backup/selection.py
parent316b6ac203137fc5740d1181c941aab1178eeaae (diff)
downloadrdiff-backup-b3c458f96706b7a6ef570434c9c9adc7129912a4.tar.gz
Bug fixes to resuming and error correction code
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@112 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/selection.py')
-rw-r--r--rdiff-backup/rdiff_backup/selection.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/rdiff-backup/rdiff_backup/selection.py b/rdiff-backup/rdiff_backup/selection.py
index 70f5e7e..c26dfab 100644
--- a/rdiff-backup/rdiff_backup/selection.py
+++ b/rdiff-backup/rdiff_backup/selection.py
@@ -91,10 +91,10 @@ class Select:
self.starting_index = starting_index
self.iter = self.iterate_starting_from(self.dsrpath,
self.iterate_starting_from, sel_func)
- else:
- assert not iterate_parents
- self.iter = self.Iterate(self.dsrpath, self.Iterate, sel_func)
- self.iterate_parents = iterate_parents
+ else: self.iter = self.Iterate(self.dsrpath, self.Iterate, sel_func)
+
+ # only iterate parents if we are not starting from beginning
+ self.iterate_parents = starting_index is not None and iterate_parents
self.next = self.iter.next
self.__iter__ = lambda: self
return self
@@ -127,17 +127,18 @@ class Select:
def iterate_in_dir(self, dsrpath, rec_func, sel_func):
"""Iterate the dsrps in directory dsrpath."""
+ def error_handler(exc, filename):
+ Log("Error initializing file %s/%s" % (dsrpath.path, filename), 2)
+ return None
+
if self.quoting_on:
for subdir in FilenameMapping.get_quoted_dir_children(dsrpath):
for dsrp in rec_func(subdir, rec_func, sel_func): yield dsrp
else:
for filename in Robust.listrp(dsrpath):
new_dsrp = Robust.check_common_error(
- lambda: dsrpath.append(filename))
- if not new_dsrp:
- Log("Error initializing file %s/%s" %
- (dsrpath.path, filename), 2)
- else:
+ error_handler, dsrpath.append, filename)
+ if new_dsrp:
for dsrp in rec_func(new_dsrp, rec_func, sel_func):
yield dsrp
@@ -208,7 +209,6 @@ class Select:
self.parse_last_excludes()
self.parse_rbdir_exclude()
- self.parse_proc_exclude()
def parse_catch_error(self, exc):
"""Deal with selection error exc"""
@@ -231,11 +231,6 @@ pattern (such as '**') which matches the base directory.""" %
self.add_selection_func(
self.glob_get_tuple_sf(("rdiff-backup-data",), 0), 1)
- def parse_proc_exclude(self):
- """Exclude the /proc directory if starting from /"""
- if self.prefix == "/":
- self.add_selection_func(self.glob_get_tuple_sf(("proc",), 0), 1)
-
def parse_last_excludes(self):
"""Exit with error if last selection function isn't an exclude"""
if (self.selection_functions and