summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/increment.py
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-06-02 20:14:08 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-06-02 20:14:08 +0000
commit26a6d142dd736feafc347651c22360b5d5574734 (patch)
tree91403a4228dfc8913328ed16f36f1fed8e2f0813 /rdiff-backup/rdiff_backup/increment.py
parent00283590c392d1322a08f84d333c5bec8d51e545 (diff)
downloadrdiff-backup-26a6d142dd736feafc347651c22360b5d5574734.tar.gz
Added --null-separator, tweaked increment error handling
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@117 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/increment.py')
-rw-r--r--rdiff-backup/rdiff_backup/increment.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/rdiff-backup/rdiff_backup/increment.py b/rdiff-backup/rdiff_backup/increment.py
index 7aa7009..5836f63 100644
--- a/rdiff-backup/rdiff_backup/increment.py
+++ b/rdiff-backup/rdiff_backup/increment.py
@@ -219,6 +219,7 @@ class IncrementITR(ErrorITR, StatsITR):
# Write updated mirror to temp file so we can compute
# reverse diff locally
mirror_tf = TempFileManager.new(dsrp)
+ old_dsrp_tf = TempFileManager.new(dsrp)
def init_thunk():
if diff_rorp.isflaglinked():
Hardlink.link_rp(diff_rorp, mirror_tf, dsrp)
@@ -226,8 +227,16 @@ class IncrementITR(ErrorITR, StatsITR):
mirror_tf).execute()
self.incrp = Inc.Increment_action(mirror_tf, dsrp,
incpref).execute()
- def final(init_val): mirror_tf.rename(dsrp)
- def error(exc, ran_init, init_val): mirror_tf.delete()
+ if dsrp.lstat(): RPathStatic.rename(dsrp, old_dsrp_tf)
+ mirror_tf.rename(dsrp)
+
+ def final(init_val): old_dsrp_tf.delete()
+ def error(exc, ran_init, init_val):
+ if ran_init: old_dsrp_tf.delete() # everything is fine
+ else: # restore to previous state
+ if old_dsrp_tf.lstat(): old_dsrp_tf.rename(dsrp)
+ if self.incrp: self.incrp.delete()
+
RobustAction(init_thunk, final, error).execute()
else: self.incrp = Robust.chain(
Inc.Increment_action(diff_rorp, dsrp, incpref),