diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-09-24 19:36:37 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-09-24 19:36:37 +0000 |
commit | a30ef01744f17349c6d9514e803b21210abb0cb7 (patch) | |
tree | 7117876093eec8a8d0cec72e030e0c9fb206d9e8 /rdiff-backup/rdiff_backup/restore.py | |
parent | dbe4bc877fd1bf6f495844b1c445eb823d9ebaad (diff) | |
download | rdiff-backup-a30ef01744f17349c6d9514e803b21210abb0cb7.tar.gz |
Fix for remote --list-changed-since and --list-at-time
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@447 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/restore.py')
-rw-r--r-- | rdiff-backup/rdiff_backup/restore.py | 38 |
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: |