From 703a2c2f87bf3cb79344b58752bb82e33e746b40 Mon Sep 17 00:00:00 2001 From: bescoto Date: Thu, 20 Mar 2003 18:52:48 +0000 Subject: Added --list-at-time option git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@308 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 9 +++++++++ rdiff-backup/TODO | 1 + rdiff-backup/rdiff-backup.1 | 8 ++++++++ rdiff-backup/rdiff_backup/Main.py | 17 ++++++++++++++++- rdiff-backup/rdiff_backup/Security.py | 4 ++-- rdiff-backup/rdiff_backup/restore.py | 10 ++++++++++ 6 files changed, 46 insertions(+), 3 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 5e7fd84..5aea3f0 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,3 +1,12 @@ +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) --------------------------- diff --git a/rdiff-backup/TODO b/rdiff-backup/TODO index 51bb553..5ae9cb0 100644 --- a/rdiff-backup/TODO +++ b/rdiff-backup/TODO @@ -1,3 +1,4 @@ +Make restores tolerant of missing files ---------[ Medium term ]--------------------------------------- diff --git a/rdiff-backup/rdiff-backup.1 b/rdiff-backup/rdiff-backup.1 index 8597da9..6dd3dfd 100644 --- a/rdiff-backup/rdiff-backup.1 +++ b/rdiff-backup/rdiff-backup.1 @@ -10,6 +10,7 @@ rdiff-backup \- local/remote mirror and incremental backup .B rdiff-backup .B {{ -l | --list-increments } .BI "| --remove-older-than " time_interval +.BI "| --list-at-time " time .BI "| --list-changed-since " time } .BI [[[ user@ ] host2.foo ]:: destination_directory ] @@ -182,11 +183,18 @@ will be included by this option. See the .B FILE SELECTION section for more information. .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 List the files that have changed since the given time. See .B TIME FORMATS for the format of .IR time . +If a directory in the archive is specified, list only the files under +that directory. .TP .B "-l, --list-increments" List the number and date of partial incremental backups contained in diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index 5381272..2cf55ae 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -51,7 +51,7 @@ def parse_cmdlineoptions(arglist): "exclude-regexp=", "exclude-special-files", "force", "include=", "include-filelist=", "include-filelist-stdin", "include-globbing-filelist=", "include-regexp=", - "list-changed-since=", "list-increments", + "list-at-time=", "list-changed-since=", "list-increments", "no-compare-inode", "no-compression", "no-compression-regexp=", "no-file-statistics", "no-hard-links", "null-separator", "parsable-output", @@ -101,6 +101,8 @@ def parse_cmdlineoptions(arglist): select_opts.append((opt, arg)) select_files.append(sel_fl(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": restore_timestr, action = arg, "list-changed-since" elif opt == "-l" or opt == "--list-increments": @@ -178,6 +180,7 @@ def set_action(): commandline_error("Two arguments are required (source, destination).") if l == 2 and (action == "list-increments" or action == "remove-older-than" or + action == "list-at-time" or action == "list-changed-since" or action == "check-destination-dir"): commandline_error("Only use one argument, " @@ -211,6 +214,7 @@ def take_action(rps): elif action == "restore": Restore(*rps) elif action == "restore-as-of": RestoreAsOf(rps[0], rps[1]) 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-increments": ListIncrements(rps[0]) elif action == "remove-older-than": RemoveOlderThan(rps[0]) @@ -562,6 +566,17 @@ def ListChangedSince(rp): 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): """Check the destination directory, """ if Globals.rbdir is None: diff --git a/rdiff-backup/rdiff_backup/Security.py b/rdiff-backup/rdiff_backup/Security.py index 9a136e2..b1785d6 100644 --- a/rdiff-backup/rdiff_backup/Security.py +++ b/rdiff-backup/rdiff_backup/Security.py @@ -94,8 +94,8 @@ def set_security_level(action, cmdpairs): sec_level = "all" rdir = getpath(cp2) elif (action == "test-server" or action == "list-increments" or - action == "list-changed-since" or action == - "calculate-average" or action == "remove-older-than"): + action == "list-at-time" or action == "list-changed-since" + or action == "calculate-average" or action == "remove-older-than"): sec_level = "minimal" rdir = tempfile.gettempdir() else: assert 0, "Unknown action %s" % action diff --git a/rdiff-backup/rdiff_backup/restore.py b/rdiff-backup/rdiff_backup/restore.py index d9d8e58..f35b83a 100644 --- a/rdiff-backup/rdiff_backup/restore.py +++ b/rdiff-backup/rdiff_backup/restore.py @@ -82,6 +82,16 @@ def ListChangedSince(mirror_rp, inc_rp, restore_to_time): 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: """Hold functions to be run on the mirror side""" def set_mirror_and_rest_times(cls, restore_to_time): -- cgit v1.2.1