From 5595491b79410e0c930100fcc7451d65e4e6d139 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 11 Sep 2002 06:10:31 +0000 Subject: Minor cleanups in Hardlink.py and robust.py, killtest update to lazy.py git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@197 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/rdiff_backup/Hardlink.py | 2 +- rdiff-backup/rdiff_backup/lazy.py | 13 +++++++------ rdiff-backup/rdiff_backup/robust.py | 5 +---- rdiff-backup/src/Hardlink.py | 2 +- rdiff-backup/src/lazy.py | 13 +++++++------ rdiff-backup/src/robust.py | 5 +---- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/rdiff-backup/rdiff_backup/Hardlink.py b/rdiff-backup/rdiff_backup/Hardlink.py index 2127a20..edca1f3 100644 --- a/rdiff-backup/rdiff_backup/Hardlink.py +++ b/rdiff-backup/rdiff_backup/Hardlink.py @@ -91,7 +91,7 @@ def rorp_eq(src_rorp, dest_rorp): indicies. """ - assert src_rorp.index == dest_rorp.index + if not src_rorp.index == dest_rorp.index: return None if (not src_rorp.isreg() or not dest_rorp.isreg() or src_rorp.getnumlinks() == dest_rorp.getnumlinks() == 1): return 1 # Hard links don't apply diff --git a/rdiff-backup/rdiff_backup/lazy.py b/rdiff-backup/rdiff_backup/lazy.py index e583676..f87a2b8 100644 --- a/rdiff-backup/rdiff_backup/lazy.py +++ b/rdiff-backup/rdiff_backup/lazy.py @@ -234,18 +234,18 @@ class IterTreeReducer: branches[-1].branch_process(to_be_finished) else: return 1 - def add_branch(self): + def add_branch(self, index): """Return branch of type self.branch_class, add to branch list""" branch = self.branch_class(*self.branch_args) + branch.base_index = index self.branches.append(branch) return branch - def process_w_branch(self, index, branch, args): + def process_w_branch(self, branch, args): """Run start_process on latest branch""" Robust.check_common_error(branch.on_error, branch.start_process, args) if not branch.caught_exception: branch.start_successful = 1 - branch.base_index = index def Finish(self): """Call at end of sequence to tie everything up""" @@ -268,7 +268,8 @@ class IterTreeReducer: """ index = args[0] if self.index is None: - self.process_w_branch(index, self.root_branch, args) + self.root_branch.base_index = index + self.process_w_branch(self.root_branch, args) self.index = index return 1 @@ -283,8 +284,8 @@ class IterTreeReducer: if last_branch.can_fast_process(*args): last_branch.fast_process(*args) else: - branch = self.add_branch() - self.process_w_branch(index, branch, args) + branch = self.add_branch(index) + self.process_w_branch(branch, args) else: last_branch.log_prev_error(index) self.index = index diff --git a/rdiff-backup/rdiff_backup/robust.py b/rdiff-backup/rdiff_backup/robust.py index 1973cc3..5726914 100644 --- a/rdiff-backup/rdiff_backup/robust.py +++ b/rdiff-backup/rdiff_backup/robust.py @@ -575,10 +575,7 @@ class Resume: mirror = None last_index = cls.sym_to_index(increment_sym) if checkpoint_rp: - result = cls.unpickle_checkpoint(checkpoint_rp) - sys.stderr.write("#############" + str(result) + "\n") - #ITR, finalizer = cls.unpickle_checkpoint(checkpoint_rp) - ITR, finalizer = result + ITR, finalizer = cls.unpickle_checkpoint(checkpoint_rp) elif mirror_sym: mirror = 1 last_index = cls.sym_to_index(mirror_sym) diff --git a/rdiff-backup/src/Hardlink.py b/rdiff-backup/src/Hardlink.py index 2127a20..edca1f3 100644 --- a/rdiff-backup/src/Hardlink.py +++ b/rdiff-backup/src/Hardlink.py @@ -91,7 +91,7 @@ def rorp_eq(src_rorp, dest_rorp): indicies. """ - assert src_rorp.index == dest_rorp.index + if not src_rorp.index == dest_rorp.index: return None if (not src_rorp.isreg() or not dest_rorp.isreg() or src_rorp.getnumlinks() == dest_rorp.getnumlinks() == 1): return 1 # Hard links don't apply diff --git a/rdiff-backup/src/lazy.py b/rdiff-backup/src/lazy.py index e583676..f87a2b8 100644 --- a/rdiff-backup/src/lazy.py +++ b/rdiff-backup/src/lazy.py @@ -234,18 +234,18 @@ class IterTreeReducer: branches[-1].branch_process(to_be_finished) else: return 1 - def add_branch(self): + def add_branch(self, index): """Return branch of type self.branch_class, add to branch list""" branch = self.branch_class(*self.branch_args) + branch.base_index = index self.branches.append(branch) return branch - def process_w_branch(self, index, branch, args): + def process_w_branch(self, branch, args): """Run start_process on latest branch""" Robust.check_common_error(branch.on_error, branch.start_process, args) if not branch.caught_exception: branch.start_successful = 1 - branch.base_index = index def Finish(self): """Call at end of sequence to tie everything up""" @@ -268,7 +268,8 @@ class IterTreeReducer: """ index = args[0] if self.index is None: - self.process_w_branch(index, self.root_branch, args) + self.root_branch.base_index = index + self.process_w_branch(self.root_branch, args) self.index = index return 1 @@ -283,8 +284,8 @@ class IterTreeReducer: if last_branch.can_fast_process(*args): last_branch.fast_process(*args) else: - branch = self.add_branch() - self.process_w_branch(index, branch, args) + branch = self.add_branch(index) + self.process_w_branch(branch, args) else: last_branch.log_prev_error(index) self.index = index diff --git a/rdiff-backup/src/robust.py b/rdiff-backup/src/robust.py index 1973cc3..5726914 100644 --- a/rdiff-backup/src/robust.py +++ b/rdiff-backup/src/robust.py @@ -575,10 +575,7 @@ class Resume: mirror = None last_index = cls.sym_to_index(increment_sym) if checkpoint_rp: - result = cls.unpickle_checkpoint(checkpoint_rp) - sys.stderr.write("#############" + str(result) + "\n") - #ITR, finalizer = cls.unpickle_checkpoint(checkpoint_rp) - ITR, finalizer = result + ITR, finalizer = cls.unpickle_checkpoint(checkpoint_rp) elif mirror_sym: mirror = 1 last_index = cls.sym_to_index(mirror_sym) -- cgit v1.2.1