summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-21 23:25:47 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-21 23:25:47 +0000
commit48c85c6792ed001c8063fec21dfd2794c32dcd28 (patch)
tree91d28a549e15e48681266b2e8a6c2cc88db10516
parent55669110eec45e22249537d3195799cf5945ad23 (diff)
downloadrdiff-backup-48c85c6792ed001c8063fec21dfd2794c32dcd28.tar.gz
Fixed source finalizer resume bug (although more remains to be done)
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@95 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/highlevel.py2
-rw-r--r--rdiff-backup/rdiff_backup/lazy.py2
-rw-r--r--rdiff-backup/rdiff_backup/robust.py8
-rw-r--r--rdiff-backup/rdiff_backup/selection.py20
-rw-r--r--rdiff-backup/src/highlevel.py2
-rw-r--r--rdiff-backup/src/lazy.py2
-rw-r--r--rdiff-backup/src/robust.py8
-rw-r--r--rdiff-backup/src/selection.py20
8 files changed, 42 insertions, 22 deletions
diff --git a/rdiff-backup/rdiff_backup/highlevel.py b/rdiff-backup/rdiff_backup/highlevel.py
index e1cfc28..5ad470a 100644
--- a/rdiff-backup/rdiff_backup/highlevel.py
+++ b/rdiff-backup/rdiff_backup/highlevel.py
@@ -76,7 +76,7 @@ class HLSourceStruct:
def iterate_from(cls):
"""Supply more aruments to DestructiveStepping.Iterate_from"""
if cls._session_info is None: Globals.select_source.set_iter()
- else: Globals.select_source.set_iter(cls._session_info.last_index)
+ else: Globals.select_source.set_iter(cls._session_info.last_index, 1)
return Globals.select_source
def split_initial_dsiter(cls):
diff --git a/rdiff-backup/rdiff_backup/lazy.py b/rdiff-backup/rdiff_backup/lazy.py
index 1bb2e2c..15da44d 100644
--- a/rdiff-backup/rdiff_backup/lazy.py
+++ b/rdiff-backup/rdiff_backup/lazy.py
@@ -241,7 +241,7 @@ class IterTreeReducer:
def Finish(self):
"""Call at end of sequence to tie everything up"""
- assert not self.finished
+ assert not self.finished, (self.base_index, self.index)
if self.subinstance:
self.subinstance.Finish()
self.branch_process(self.subinstance)
diff --git a/rdiff-backup/rdiff_backup/robust.py b/rdiff-backup/rdiff_backup/robust.py
index e92a701..b38e792 100644
--- a/rdiff-backup/rdiff_backup/robust.py
+++ b/rdiff-backup/rdiff_backup/robust.py
@@ -200,8 +200,7 @@ class Robust:
"""
try: return init_thunk()
except (EnvironmentError, SkipFileException, DSRPPermError,
- RPathException), exc:
- Log.exception()
+ RPathException, RdiffException), exc:
if (not isinstance(exc, EnvironmentError) or
(errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
@@ -209,8 +208,11 @@ class Robust:
'EIO', # reported by docv
'ETXTBSY' # reported by Campbell on some NT system
])):
+ Log.exception()
return error_thunk(exc)
- else: raise
+ else:
+ Log.exception(1, 2)
+ raise
def listrp(rp):
"""Like rp.listdir() but return [] if error, and sort results"""
diff --git a/rdiff-backup/rdiff_backup/selection.py b/rdiff-backup/rdiff_backup/selection.py
index 94da6f1..70f5e7e 100644
--- a/rdiff-backup/rdiff_backup/selection.py
+++ b/rdiff-backup/rdiff_backup/selection.py
@@ -74,12 +74,15 @@ class Select:
self.prefix = self.dsrpath.path
self.quoting_on = Globals.quoting_enabled and quoted_filenames
- def set_iter(self, starting_index = None, sel_func = None):
+ def set_iter(self, starting_index = None, iterate_parents = None,
+ sel_func = None):
"""Initialize more variables, get ready to iterate
- Will iterate indicies greater than starting_index. Selection
- function sel_func is called on each dsrp and is usually
- self.Select. Returns self just for convenience.
+ Will iterate indicies greater than starting_index. If
+ iterate_parents is true, will also include parents of
+ starting_index in iteration. Selection function sel_func is
+ called on each dsrp and is usually self.Select. Returns self
+ just for convenience.
"""
if not sel_func: sel_func = self.Select
@@ -88,7 +91,10 @@ class Select:
self.starting_index = starting_index
self.iter = self.iterate_starting_from(self.dsrpath,
self.iterate_starting_from, sel_func)
- else: self.iter = self.Iterate(self.dsrpath, self.Iterate, sel_func)
+ else:
+ assert not iterate_parents
+ self.iter = self.Iterate(self.dsrpath, self.Iterate, sel_func)
+ self.iterate_parents = iterate_parents
self.next = self.iter.next
self.__iter__ = lambda: self
return self
@@ -140,8 +146,10 @@ class Select:
if dsrpath.index > self.starting_index: # past starting_index
for dsrp in self.Iterate(dsrpath, self.Iterate, sel_func):
yield dsrp
- elif dsrpath.index == self.starting_index[:len(dsrpath.index)]:
+ elif (dsrpath.index == self.starting_index[:len(dsrpath.index)]
+ and dsrpath.isdir()):
# May encounter starting index on this branch
+ if self.iterate_parents: yield dsrpath
for dsrp in self.iterate_in_dir(dsrpath,
self.iterate_starting_from,
sel_func): yield dsrp
diff --git a/rdiff-backup/src/highlevel.py b/rdiff-backup/src/highlevel.py
index e1cfc28..5ad470a 100644
--- a/rdiff-backup/src/highlevel.py
+++ b/rdiff-backup/src/highlevel.py
@@ -76,7 +76,7 @@ class HLSourceStruct:
def iterate_from(cls):
"""Supply more aruments to DestructiveStepping.Iterate_from"""
if cls._session_info is None: Globals.select_source.set_iter()
- else: Globals.select_source.set_iter(cls._session_info.last_index)
+ else: Globals.select_source.set_iter(cls._session_info.last_index, 1)
return Globals.select_source
def split_initial_dsiter(cls):
diff --git a/rdiff-backup/src/lazy.py b/rdiff-backup/src/lazy.py
index 1bb2e2c..15da44d 100644
--- a/rdiff-backup/src/lazy.py
+++ b/rdiff-backup/src/lazy.py
@@ -241,7 +241,7 @@ class IterTreeReducer:
def Finish(self):
"""Call at end of sequence to tie everything up"""
- assert not self.finished
+ assert not self.finished, (self.base_index, self.index)
if self.subinstance:
self.subinstance.Finish()
self.branch_process(self.subinstance)
diff --git a/rdiff-backup/src/robust.py b/rdiff-backup/src/robust.py
index e92a701..b38e792 100644
--- a/rdiff-backup/src/robust.py
+++ b/rdiff-backup/src/robust.py
@@ -200,8 +200,7 @@ class Robust:
"""
try: return init_thunk()
except (EnvironmentError, SkipFileException, DSRPPermError,
- RPathException), exc:
- Log.exception()
+ RPathException, RdiffException), exc:
if (not isinstance(exc, EnvironmentError) or
(errno.errorcode[exc[0]] in
['EPERM', 'ENOENT', 'EACCES', 'EBUSY', 'EEXIST',
@@ -209,8 +208,11 @@ class Robust:
'EIO', # reported by docv
'ETXTBSY' # reported by Campbell on some NT system
])):
+ Log.exception()
return error_thunk(exc)
- else: raise
+ else:
+ Log.exception(1, 2)
+ raise
def listrp(rp):
"""Like rp.listdir() but return [] if error, and sort results"""
diff --git a/rdiff-backup/src/selection.py b/rdiff-backup/src/selection.py
index 94da6f1..70f5e7e 100644
--- a/rdiff-backup/src/selection.py
+++ b/rdiff-backup/src/selection.py
@@ -74,12 +74,15 @@ class Select:
self.prefix = self.dsrpath.path
self.quoting_on = Globals.quoting_enabled and quoted_filenames
- def set_iter(self, starting_index = None, sel_func = None):
+ def set_iter(self, starting_index = None, iterate_parents = None,
+ sel_func = None):
"""Initialize more variables, get ready to iterate
- Will iterate indicies greater than starting_index. Selection
- function sel_func is called on each dsrp and is usually
- self.Select. Returns self just for convenience.
+ Will iterate indicies greater than starting_index. If
+ iterate_parents is true, will also include parents of
+ starting_index in iteration. Selection function sel_func is
+ called on each dsrp and is usually self.Select. Returns self
+ just for convenience.
"""
if not sel_func: sel_func = self.Select
@@ -88,7 +91,10 @@ class Select:
self.starting_index = starting_index
self.iter = self.iterate_starting_from(self.dsrpath,
self.iterate_starting_from, sel_func)
- else: self.iter = self.Iterate(self.dsrpath, self.Iterate, sel_func)
+ else:
+ assert not iterate_parents
+ self.iter = self.Iterate(self.dsrpath, self.Iterate, sel_func)
+ self.iterate_parents = iterate_parents
self.next = self.iter.next
self.__iter__ = lambda: self
return self
@@ -140,8 +146,10 @@ class Select:
if dsrpath.index > self.starting_index: # past starting_index
for dsrp in self.Iterate(dsrpath, self.Iterate, sel_func):
yield dsrp
- elif dsrpath.index == self.starting_index[:len(dsrpath.index)]:
+ elif (dsrpath.index == self.starting_index[:len(dsrpath.index)]
+ and dsrpath.isdir()):
# May encounter starting index on this branch
+ if self.iterate_parents: yield dsrpath
for dsrp in self.iterate_in_dir(dsrpath,
self.iterate_starting_from,
sel_func): yield dsrp