Commit c79d2ad5 authored by bescoto's avatar bescoto

Fix for remote --list-changed-since and --list-at-time


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@447 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 4600e590
...@@ -4,6 +4,9 @@ New in v0.13.3 (??????????) ...@@ -4,6 +4,9 @@ New in v0.13.3 (??????????)
Fixed some of the --restrict options which would cause spurious Fixed some of the --restrict options which would cause spurious
violation errors. violation errors.
--list-changed-since and --list-at-time now work remotely.
Thanks to Morten Werner Olsen for bug report.
New in v0.13.2 (2003/09/16) New in v0.13.2 (2003/09/16)
--------------------------- ---------------------------
......
...@@ -662,7 +662,9 @@ def ListChangedSince(rp): ...@@ -662,7 +662,9 @@ def ListChangedSince(rp):
restore_check_backup_dir(restore_root) restore_check_backup_dir(restore_root)
mirror_rp = restore_root.new_index(restore_index) mirror_rp = restore_root.new_index(restore_index)
inc_rp = mirror_rp.append_path("increments", restore_index) inc_rp = mirror_rp.append_path("increments", restore_index)
restore.ListChangedSince(mirror_rp, inc_rp, rest_time) for rorp in rp.conn.restore.ListChangedSince(mirror_rp, inc_rp, rest_time):
# This is a hack, see restore.ListChangedSince for rational
print rorp.index[0]
def ListAtTime(rp): def ListAtTime(rp):
...@@ -673,7 +675,9 @@ def ListAtTime(rp): ...@@ -673,7 +675,9 @@ def ListAtTime(rp):
restore_check_backup_dir(restore_root) restore_check_backup_dir(restore_root)
mirror_rp = restore_root.new_index(restore_index) mirror_rp = restore_root.new_index(restore_index)
inc_rp = mirror_rp.append_path("increments", restore_index) inc_rp = mirror_rp.append_path("increments", restore_index)
restore.ListAtTime(mirror_rp, inc_rp, rest_time) for rorp in rp.conn.restore.ListAtTime(mirror_rp, inc_rp, rest_time):
# Hack for remote operation, see restore.ListChangedSince for rational
print rorp.index[0]
def CheckDest(dest_rp): def CheckDest(dest_rp):
......
...@@ -64,13 +64,20 @@ def get_inclist(inc_rpath): ...@@ -64,13 +64,20 @@ def get_inclist(inc_rpath):
return inc_list return inc_list
def ListChangedSince(mirror_rp, inc_rp, restore_to_time): def ListChangedSince(mirror_rp, inc_rp, restore_to_time):
"""List the changed files under mirror_rp since rest 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) Notice the output is an iterator of RORPs. We do this because we
MirrorS.initialize_rf_cache(mirror_rp, inc_rp) 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 = MirrorStruct.get_mirror_rorp_iter(_rest_time, 1)
old_iter = MirrorS.get_mirror_rorp_iter(_rest_time, 1) cur_iter = MirrorStruct.get_mirror_rorp_iter(_mirror_time, 1)
collated = rorpiter.Collate2Iters(old_iter, cur_iter) collated = rorpiter.Collate2Iters(old_iter, cur_iter)
for old_rorp, cur_rorp in collated: for old_rorp, cur_rorp in collated:
if not old_rorp: change = "new" if not old_rorp: change = "new"
...@@ -79,17 +86,22 @@ def ListChangedSince(mirror_rp, inc_rp, restore_to_time): ...@@ -79,17 +86,22 @@ def ListChangedSince(mirror_rp, inc_rp, restore_to_time):
else: change = "changed" else: change = "changed"
path_desc = (old_rorp and old_rorp.get_indexpath() or path_desc = (old_rorp and old_rorp.get_indexpath() or
cur_rorp.get_indexpath()) 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): def ListAtTime(mirror_rp, inc_rp, time):
"""List the files in archive at the given time""" """List the files in archive at the given time
MirrorS = mirror_rp.conn.restore.MirrorStruct
MirrorS.set_mirror_and_rest_times(time) Output is a RORP Iterator with info in index. See ListChangedSince.
MirrorS.initialize_rf_cache(mirror_rp, inc_rp)
"""
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) old_iter = MirrorStruct.get_mirror_rorp_iter(_rest_time, 1)
for rorp in old_iter: print rorp.get_indexpath() for rorp in old_iter:
yield rpath.RORPath((rorp.get_indexpath(),))
class MirrorStruct: class MirrorStruct:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment