summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/restore.py
diff options
context:
space:
mode:
Diffstat (limited to 'rdiff-backup/rdiff_backup/restore.py')
-rw-r--r--rdiff-backup/rdiff_backup/restore.py38
1 files changed, 25 insertions, 13 deletions
diff --git a/rdiff-backup/rdiff_backup/restore.py b/rdiff-backup/rdiff_backup/restore.py
index 7e88a61..a2a5193 100644
--- a/rdiff-backup/rdiff_backup/restore.py
+++ b/rdiff-backup/rdiff_backup/restore.py
@@ -64,13 +64,20 @@ def get_inclist(inc_rpath):
return inc_list
def ListChangedSince(mirror_rp, inc_rp, restore_to_time):
- """List the changed files under mirror_rp since rest time"""
- MirrorS = mirror_rp.conn.restore.MirrorStruct
- MirrorS.set_mirror_and_rest_times(restore_to_time)
- MirrorS.initialize_rf_cache(mirror_rp, inc_rp)
+ """List the changed files under mirror_rp since rest time
+
+ Notice the output is an iterator of RORPs. We do this because we
+ want to give the remote connection the data in buffered
+ increments, and this is done automatically for rorp iterators.
+ Encode the lines in the first element of the rorp's index.
+
+ """
+ assert mirror_rp.conn is Globals.local_connection, "Run locally only"
+ MirrorStruct.set_mirror_and_rest_times(restore_to_time)
+ MirrorStruct.initialize_rf_cache(mirror_rp, inc_rp)
- cur_iter = MirrorS.get_mirror_rorp_iter(_mirror_time, 1)
- old_iter = MirrorS.get_mirror_rorp_iter(_rest_time, 1)
+ old_iter = MirrorStruct.get_mirror_rorp_iter(_rest_time, 1)
+ cur_iter = MirrorStruct.get_mirror_rorp_iter(_mirror_time, 1)
collated = rorpiter.Collate2Iters(old_iter, cur_iter)
for old_rorp, cur_rorp in collated:
if not old_rorp: change = "new"
@@ -79,17 +86,22 @@ def ListChangedSince(mirror_rp, inc_rp, restore_to_time):
else: change = "changed"
path_desc = (old_rorp and old_rorp.get_indexpath() or
cur_rorp.get_indexpath())
- print "%-7s %s" % (change, path_desc)
+ yield rpath.RORPath(("%-7s %s" % (change, path_desc),))
def ListAtTime(mirror_rp, inc_rp, time):
- """List the files in archive at the given time"""
- MirrorS = mirror_rp.conn.restore.MirrorStruct
- MirrorS.set_mirror_and_rest_times(time)
- MirrorS.initialize_rf_cache(mirror_rp, inc_rp)
+ """List the files in archive at the given time
+
+ Output is a RORP Iterator with info in index. See ListChangedSince.
+
+ """
+ assert mirror_rp.conn is Globals.local_connection, "Run locally only"
+ MirrorStruct.set_mirror_and_rest_times(time)
+ MirrorStruct.initialize_rf_cache(mirror_rp, inc_rp)
- old_iter = MirrorS.get_mirror_rorp_iter(_rest_time, 1)
- for rorp in old_iter: print rorp.get_indexpath()
+ old_iter = MirrorStruct.get_mirror_rorp_iter(_rest_time, 1)
+ for rorp in old_iter:
+ yield rpath.RORPath((rorp.get_indexpath(),))
class MirrorStruct: