Commit b5c8892c authored by bescoto's avatar bescoto

Added --list-at-time option


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@308 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 087f90e8
New in v0.12.0 (2003/??/??)
---------------------------
Added EDEADLOCK to the list of skippable errors. (Thanks to Dave
Kempe for report.)
Added --list-at-time option at request of Farkas Levente.
New in v0.11.4 (2003/03/15) New in v0.11.4 (2003/03/15)
--------------------------- ---------------------------
......
Make restores tolerant of missing files
---------[ Medium term ]--------------------------------------- ---------[ Medium term ]---------------------------------------
......
...@@ -10,6 +10,7 @@ rdiff-backup \- local/remote mirror and incremental backup ...@@ -10,6 +10,7 @@ rdiff-backup \- local/remote mirror and incremental backup
.B rdiff-backup .B rdiff-backup
.B {{ -l | --list-increments } .B {{ -l | --list-increments }
.BI "| --remove-older-than " time_interval .BI "| --remove-older-than " time_interval
.BI "| --list-at-time " time
.BI "| --list-changed-since " time } .BI "| --list-changed-since " time }
.BI [[[ user@ ] host2.foo ]:: destination_directory ] .BI [[[ user@ ] host2.foo ]:: destination_directory ]
...@@ -182,11 +183,18 @@ will be included by this option. See the ...@@ -182,11 +183,18 @@ will be included by this option. See the
.B FILE SELECTION .B FILE SELECTION
section for more information. section for more information.
.TP .TP
.BI "--list-at-time " time
List the files in the archive that were present at the given time. If
a directory in the archive is specified, list only the files under
that directory.
.TP
.BI "--list-changed-since " time .BI "--list-changed-since " time
List the files that have changed since the given time. See List the files that have changed since the given time. See
.B TIME FORMATS .B TIME FORMATS
for the format of for the format of
.IR time . .IR time .
If a directory in the archive is specified, list only the files under
that directory.
.TP .TP
.B "-l, --list-increments" .B "-l, --list-increments"
List the number and date of partial incremental backups contained in List the number and date of partial incremental backups contained in
......
...@@ -51,7 +51,7 @@ def parse_cmdlineoptions(arglist): ...@@ -51,7 +51,7 @@ def parse_cmdlineoptions(arglist):
"exclude-regexp=", "exclude-special-files", "force", "exclude-regexp=", "exclude-special-files", "force",
"include=", "include-filelist=", "include-filelist-stdin", "include=", "include-filelist=", "include-filelist-stdin",
"include-globbing-filelist=", "include-regexp=", "include-globbing-filelist=", "include-regexp=",
"list-changed-since=", "list-increments", "list-at-time=", "list-changed-since=", "list-increments",
"no-compare-inode", "no-compression", "no-compare-inode", "no-compression",
"no-compression-regexp=", "no-file-statistics", "no-compression-regexp=", "no-file-statistics",
"no-hard-links", "null-separator", "parsable-output", "no-hard-links", "null-separator", "parsable-output",
...@@ -101,6 +101,8 @@ def parse_cmdlineoptions(arglist): ...@@ -101,6 +101,8 @@ def parse_cmdlineoptions(arglist):
select_opts.append((opt, arg)) select_opts.append((opt, arg))
select_files.append(sel_fl(arg)) select_files.append(sel_fl(arg))
elif opt == "--include-regexp": select_opts.append((opt, arg)) elif opt == "--include-regexp": select_opts.append((opt, arg))
elif opt == "--list-at-time":
restore_timestr, action = arg, "list-at-time"
elif opt == "--list-changed-since": elif opt == "--list-changed-since":
restore_timestr, action = arg, "list-changed-since" restore_timestr, action = arg, "list-changed-since"
elif opt == "-l" or opt == "--list-increments": elif opt == "-l" or opt == "--list-increments":
...@@ -178,6 +180,7 @@ def set_action(): ...@@ -178,6 +180,7 @@ def set_action():
commandline_error("Two arguments are required (source, destination).") commandline_error("Two arguments are required (source, destination).")
if l == 2 and (action == "list-increments" or if l == 2 and (action == "list-increments" or
action == "remove-older-than" or action == "remove-older-than" or
action == "list-at-time" or
action == "list-changed-since" or action == "list-changed-since" or
action == "check-destination-dir"): action == "check-destination-dir"):
commandline_error("Only use one argument, " commandline_error("Only use one argument, "
...@@ -211,6 +214,7 @@ def take_action(rps): ...@@ -211,6 +214,7 @@ def take_action(rps):
elif action == "restore": Restore(*rps) elif action == "restore": Restore(*rps)
elif action == "restore-as-of": RestoreAsOf(rps[0], rps[1]) elif action == "restore-as-of": RestoreAsOf(rps[0], rps[1])
elif action == "test-server": SetConnections.TestConnections() elif action == "test-server": SetConnections.TestConnections()
elif action == "list-at-time": ListAtTime(rps[0])
elif action == "list-changed-since": ListChangedSince(rps[0]) elif action == "list-changed-since": ListChangedSince(rps[0])
elif action == "list-increments": ListIncrements(rps[0]) elif action == "list-increments": ListIncrements(rps[0])
elif action == "remove-older-than": RemoveOlderThan(rps[0]) elif action == "remove-older-than": RemoveOlderThan(rps[0])
...@@ -562,6 +566,17 @@ def ListChangedSince(rp): ...@@ -562,6 +566,17 @@ def ListChangedSince(rp):
restore.ListChangedSince(mirror_rp, inc_rp, rest_time) restore.ListChangedSince(mirror_rp, inc_rp, rest_time)
def ListAtTime(rp):
"""List files in archive under rp that are present at restoretime"""
try: rest_time = Time.genstrtotime(restore_timestr)
except Time.TimeException, exc: Log.FatalError(str(exc))
mirror_root, index = restore_get_root(rp)
restore_check_backup_dir(mirror_root)
mirror_rp = mirror_root.new_index(index)
inc_rp = mirror_rp.append_path("increments", index)
restore.ListAtTime(mirror_rp, inc_rp, rest_time)
def CheckDest(dest_rp): def CheckDest(dest_rp):
"""Check the destination directory, """ """Check the destination directory, """
if Globals.rbdir is None: if Globals.rbdir is None:
......
...@@ -94,8 +94,8 @@ def set_security_level(action, cmdpairs): ...@@ -94,8 +94,8 @@ def set_security_level(action, cmdpairs):
sec_level = "all" sec_level = "all"
rdir = getpath(cp2) rdir = getpath(cp2)
elif (action == "test-server" or action == "list-increments" or elif (action == "test-server" or action == "list-increments" or
action == "list-changed-since" or action == action == "list-at-time" or action == "list-changed-since"
"calculate-average" or action == "remove-older-than"): or action == "calculate-average" or action == "remove-older-than"):
sec_level = "minimal" sec_level = "minimal"
rdir = tempfile.gettempdir() rdir = tempfile.gettempdir()
else: assert 0, "Unknown action %s" % action else: assert 0, "Unknown action %s" % action
......
...@@ -82,6 +82,16 @@ def ListChangedSince(mirror_rp, inc_rp, restore_to_time): ...@@ -82,6 +82,16 @@ def ListChangedSince(mirror_rp, inc_rp, restore_to_time):
print "%-7s %s" % (change, path_desc) print "%-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)
old_iter = MirrorS.get_mirror_rorp_iter(_rest_time, 1)
for rorp in old_iter: print rorp.get_indexpath()
class MirrorStruct: class MirrorStruct:
"""Hold functions to be run on the mirror side""" """Hold functions to be run on the mirror side"""
def set_mirror_and_rest_times(cls, restore_to_time): def set_mirror_and_rest_times(cls, restore_to_time):
......
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