summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-11-22 08:07:01 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-11-22 08:07:01 +0000
commit104bb0cd242be050b030b559d2f7498160e1a2f4 (patch)
tree711bbf3276928d62697ec6d51cde1c64c9c4d07b
parente4d46b43f475ddbc14f23933210a435e1255cf65 (diff)
downloadrdiff-backup-104bb0cd242be050b030b559d2f7498160e1a2f4.tar.gz
Changes, only one I remember is adding --list-changed-since
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@231 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/Main.py43
-rw-r--r--rdiff-backup/rdiff_backup/Security.py3
-rw-r--r--rdiff-backup/rdiff_backup/destructive_stepping.py1
-rw-r--r--rdiff-backup/rdiff_backup/increment.py2
-rw-r--r--rdiff-backup/rdiff_backup/lazy.py5
-rw-r--r--rdiff-backup/rdiff_backup/robust.py1
-rw-r--r--rdiff-backup/rdiff_backup/rorpiter.py1
-rw-r--r--rdiff-backup/rdiff_backup/selection.py2
-rw-r--r--rdiff-backup/src/Main.py43
-rw-r--r--rdiff-backup/src/Security.py3
-rw-r--r--rdiff-backup/src/destructive_stepping.py1
-rw-r--r--rdiff-backup/src/increment.py2
-rw-r--r--rdiff-backup/src/lazy.py5
-rw-r--r--rdiff-backup/src/robust.py1
-rw-r--r--rdiff-backup/src/rorpiter.py1
-rw-r--r--rdiff-backup/src/selection.py2
16 files changed, 84 insertions, 32 deletions
diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py
index 186182f..c3eb694 100644
--- a/rdiff-backup/rdiff_backup/Main.py
+++ b/rdiff-backup/rdiff_backup/Main.py
@@ -10,6 +10,7 @@
"""Start (and end) here - read arguments, set global settings, etc."""
+from __future__ import generators
import getopt, sys, re
from log import *
from lazy import *
@@ -48,13 +49,13 @@ def parse_cmdlineoptions(arglist):
"exclude-regexp=", "exclude-special-files", "force",
"include=", "include-filelist=", "include-filelist-stdin",
"include-globbing-filelist=", "include-regexp=",
- "list-increments", "mirror-only", "no-compression",
- "no-compression-regexp=", "no-hard-links", "no-resume",
- "null-separator", "parsable-output", "print-statistics",
- "quoting-char=", "remote-cmd=", "remote-schema=",
- "remove-older-than=", "restore-as-of=", "restrict=",
- "restrict-read-only=", "restrict-update-only=", "resume",
- "resume-window=", "server", "sleep-ratio=",
+ "list-changed-since=", "list-increments", "mirror-only",
+ "no-compression", "no-compression-regexp=", "no-hard-links",
+ "no-resume", "null-separator", "parsable-output",
+ "print-statistics", "quoting-char=", "remote-cmd=",
+ "remote-schema=", "remove-older-than=", "restore-as-of=",
+ "restrict=", "restrict-read-only=", "restrict-update-only=",
+ "resume", "resume-window=", "server", "sleep-ratio=",
"ssh-no-compression", "terminal-verbosity=", "test-server",
"verbosity=", "version", "windows-mode",
"windows-time-format"])
@@ -101,6 +102,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-changed-since":
+ restore_timestr, action = arg, "list-changed-since"
elif opt == "-l" or opt == "--list-increments":
action = "list-increments"
elif opt == "-m" or opt == "--mirror-only": action = "mirror"
@@ -177,7 +180,8 @@ def set_action():
action == "restore-as-of"):
commandline_error("Two arguments are required (source, destination).")
if l == 2 and (action == "list-increments" or
- action == "remove-older-than"):
+ action == "remove-older-than" or
+ action == "list-changed-since"):
commandline_error("Only use one argument, "
"the root of the backup directory")
if l > 2 and action != "calculate-average":
@@ -217,6 +221,7 @@ def take_action(rps):
elif action == "restore-as-of": RestoreAsOf(rps[0], rps[1])
elif action == "mirror": Mirror(rps[0], rps[1])
elif action == "test-server": SetConnections.TestConnections()
+ elif action == "list-changed-since": ListChangedSince(rps[0])
elif action == "list-increments": ListIncrements(rps[0])
elif action == "remove-older-than": RemoveOlderThan(rps[0])
elif action == "calculate-average": CalculateAverage(rps)
@@ -535,3 +540,25 @@ def RemoveOlderThan(rootrp):
else: Log("Deleting increments at times:\n" + inc_pretty_time, 3)
Manage.delete_earlier_than(datadir, time)
+
+def ListChangedSince(rp):
+ """List all the files under rp that have changed since restoretime"""
+ try: rest_time = Time.genstrtotime(restore_timestr)
+ except Time.TimeException, exc: Log.FatalError(str(exc))
+ mirror_root, index = restore_get_root(rp)
+ Globals.rbdir = datadir = mirror_root.append_path("rdiff-backup-data")
+ mirror_time = Restore.get_mirror_time()
+
+ def get_rids_recursive(rid):
+ """Yield all the rids under rid that have inc newer than rest_time"""
+ yield rid
+ for sub_rid in Restore.yield_rids(rid, rest_time, mirror_time):
+ for sub_sub_rid in get_rids_recursive(sub_rid): yield sub_sub_rid
+
+ inc_rpath = datadir.append_path('increments', index)
+ inc_list = Restore.get_inclist(inc_rpath)
+ root_rid = RestoreIncrementData(index, inc_rpath, inc_list)
+ for rid in get_rids_recursive(root_rid):
+ if rid.inc_list: print "/".join(rid.index)
+
+
diff --git a/rdiff-backup/rdiff_backup/Security.py b/rdiff-backup/rdiff_backup/Security.py
index 95b8296..ea9a6d8 100644
--- a/rdiff-backup/rdiff_backup/Security.py
+++ b/rdiff-backup/rdiff_backup/Security.py
@@ -85,7 +85,8 @@ def set_security_level(action, cmdpairs):
sec_level = "all"
rdir = getpath(cp2)
elif (action == "test-server" or action == "list-increments" or
- action == "calculate-average" or action == "remove-older-than"):
+ 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/destructive_stepping.py b/rdiff-backup/rdiff_backup/destructive_stepping.py
index 1688f7c..b861b54 100644
--- a/rdiff-backup/rdiff_backup/destructive_stepping.py
+++ b/rdiff-backup/rdiff_backup/destructive_stepping.py
@@ -15,7 +15,6 @@ import types
from rpath import *
from lazy import *
-
class DSRPPermError(Exception):
"""Exception used when a DSRPath can't get sufficient permissions"""
pass
diff --git a/rdiff-backup/rdiff_backup/increment.py b/rdiff-backup/rdiff_backup/increment.py
index 814322d..19880d7 100644
--- a/rdiff-backup/rdiff_backup/increment.py
+++ b/rdiff-backup/rdiff_backup/increment.py
@@ -15,7 +15,6 @@ from static import *
from statistics import *
from lazy import *
-
class Inc:
"""Class containing increment functions"""
def Increment_action(new, mirror, incpref):
@@ -322,3 +321,4 @@ from rpath import *
from robust import *
from rorpiter import *
import Globals, Time, MiscStats
+
diff --git a/rdiff-backup/rdiff_backup/lazy.py b/rdiff-backup/rdiff_backup/lazy.py
index f87a2b8..eddf63c 100644
--- a/rdiff-backup/rdiff_backup/lazy.py
+++ b/rdiff-backup/rdiff_backup/lazy.py
@@ -13,7 +13,7 @@
from __future__ import generators
import os, stat, types
from static import *
-
+import psyco
class Iter:
"""Hold static methods for the manipulation of lazy iterators"""
@@ -291,6 +291,8 @@ class IterTreeReducer:
self.index = index
return 1
+psyco.bind(IterTreeReducer)
+
class ITRBranch:
"""Helper class for IterTreeReducer below
@@ -355,4 +357,3 @@ class ITRBranch:
# Put at bottom to prevent (viciously) circular module dependencies
from robust import *
from log import *
-
diff --git a/rdiff-backup/rdiff_backup/robust.py b/rdiff-backup/rdiff_backup/robust.py
index 081aba3..7799b17 100644
--- a/rdiff-backup/rdiff_backup/robust.py
+++ b/rdiff-backup/rdiff_backup/robust.py
@@ -40,7 +40,6 @@ able to narrow down the possibilities.
import tempfile, errno, signal, cPickle, C
from static import *
-
class RobustAction:
"""Represents a file operation to be accomplished later"""
def __init__(self, init_thunk, final_func, error_handler):
diff --git a/rdiff-backup/rdiff_backup/rorpiter.py b/rdiff-backup/rdiff_backup/rorpiter.py
index 1e85d55..f566a4c 100644
--- a/rdiff-backup/rdiff_backup/rorpiter.py
+++ b/rdiff-backup/rdiff_backup/rorpiter.py
@@ -19,7 +19,6 @@ from robust import *
from iterfile import *
import Globals, Rdiff, Hardlink
-
class RORPIterException(Exception): pass
class RORPIter:
diff --git a/rdiff-backup/rdiff_backup/selection.py b/rdiff-backup/rdiff_backup/selection.py
index 6c59ccc..287d287 100644
--- a/rdiff-backup/rdiff_backup/selection.py
+++ b/rdiff-backup/rdiff_backup/selection.py
@@ -283,7 +283,7 @@ class Select:
elif opt == "--include-regexp":
self.add_selection_func(self.regexp_get_sf(arg, 1))
else: assert 0, "Bad selection option %s" % opt
- except SelectError, e: self.parse_catch_error(e)
+ except IOError: pass#SelectError, e: self.parse_catch_error(e)
assert filelists_index == len(filelists)
self.parse_last_excludes()
diff --git a/rdiff-backup/src/Main.py b/rdiff-backup/src/Main.py
index 186182f..c3eb694 100644
--- a/rdiff-backup/src/Main.py
+++ b/rdiff-backup/src/Main.py
@@ -10,6 +10,7 @@
"""Start (and end) here - read arguments, set global settings, etc."""
+from __future__ import generators
import getopt, sys, re
from log import *
from lazy import *
@@ -48,13 +49,13 @@ def parse_cmdlineoptions(arglist):
"exclude-regexp=", "exclude-special-files", "force",
"include=", "include-filelist=", "include-filelist-stdin",
"include-globbing-filelist=", "include-regexp=",
- "list-increments", "mirror-only", "no-compression",
- "no-compression-regexp=", "no-hard-links", "no-resume",
- "null-separator", "parsable-output", "print-statistics",
- "quoting-char=", "remote-cmd=", "remote-schema=",
- "remove-older-than=", "restore-as-of=", "restrict=",
- "restrict-read-only=", "restrict-update-only=", "resume",
- "resume-window=", "server", "sleep-ratio=",
+ "list-changed-since=", "list-increments", "mirror-only",
+ "no-compression", "no-compression-regexp=", "no-hard-links",
+ "no-resume", "null-separator", "parsable-output",
+ "print-statistics", "quoting-char=", "remote-cmd=",
+ "remote-schema=", "remove-older-than=", "restore-as-of=",
+ "restrict=", "restrict-read-only=", "restrict-update-only=",
+ "resume", "resume-window=", "server", "sleep-ratio=",
"ssh-no-compression", "terminal-verbosity=", "test-server",
"verbosity=", "version", "windows-mode",
"windows-time-format"])
@@ -101,6 +102,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-changed-since":
+ restore_timestr, action = arg, "list-changed-since"
elif opt == "-l" or opt == "--list-increments":
action = "list-increments"
elif opt == "-m" or opt == "--mirror-only": action = "mirror"
@@ -177,7 +180,8 @@ def set_action():
action == "restore-as-of"):
commandline_error("Two arguments are required (source, destination).")
if l == 2 and (action == "list-increments" or
- action == "remove-older-than"):
+ action == "remove-older-than" or
+ action == "list-changed-since"):
commandline_error("Only use one argument, "
"the root of the backup directory")
if l > 2 and action != "calculate-average":
@@ -217,6 +221,7 @@ def take_action(rps):
elif action == "restore-as-of": RestoreAsOf(rps[0], rps[1])
elif action == "mirror": Mirror(rps[0], rps[1])
elif action == "test-server": SetConnections.TestConnections()
+ elif action == "list-changed-since": ListChangedSince(rps[0])
elif action == "list-increments": ListIncrements(rps[0])
elif action == "remove-older-than": RemoveOlderThan(rps[0])
elif action == "calculate-average": CalculateAverage(rps)
@@ -535,3 +540,25 @@ def RemoveOlderThan(rootrp):
else: Log("Deleting increments at times:\n" + inc_pretty_time, 3)
Manage.delete_earlier_than(datadir, time)
+
+def ListChangedSince(rp):
+ """List all the files under rp that have changed since restoretime"""
+ try: rest_time = Time.genstrtotime(restore_timestr)
+ except Time.TimeException, exc: Log.FatalError(str(exc))
+ mirror_root, index = restore_get_root(rp)
+ Globals.rbdir = datadir = mirror_root.append_path("rdiff-backup-data")
+ mirror_time = Restore.get_mirror_time()
+
+ def get_rids_recursive(rid):
+ """Yield all the rids under rid that have inc newer than rest_time"""
+ yield rid
+ for sub_rid in Restore.yield_rids(rid, rest_time, mirror_time):
+ for sub_sub_rid in get_rids_recursive(sub_rid): yield sub_sub_rid
+
+ inc_rpath = datadir.append_path('increments', index)
+ inc_list = Restore.get_inclist(inc_rpath)
+ root_rid = RestoreIncrementData(index, inc_rpath, inc_list)
+ for rid in get_rids_recursive(root_rid):
+ if rid.inc_list: print "/".join(rid.index)
+
+
diff --git a/rdiff-backup/src/Security.py b/rdiff-backup/src/Security.py
index 95b8296..ea9a6d8 100644
--- a/rdiff-backup/src/Security.py
+++ b/rdiff-backup/src/Security.py
@@ -85,7 +85,8 @@ def set_security_level(action, cmdpairs):
sec_level = "all"
rdir = getpath(cp2)
elif (action == "test-server" or action == "list-increments" or
- action == "calculate-average" or action == "remove-older-than"):
+ 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/src/destructive_stepping.py b/rdiff-backup/src/destructive_stepping.py
index 1688f7c..b861b54 100644
--- a/rdiff-backup/src/destructive_stepping.py
+++ b/rdiff-backup/src/destructive_stepping.py
@@ -15,7 +15,6 @@ import types
from rpath import *
from lazy import *
-
class DSRPPermError(Exception):
"""Exception used when a DSRPath can't get sufficient permissions"""
pass
diff --git a/rdiff-backup/src/increment.py b/rdiff-backup/src/increment.py
index 814322d..19880d7 100644
--- a/rdiff-backup/src/increment.py
+++ b/rdiff-backup/src/increment.py
@@ -15,7 +15,6 @@ from static import *
from statistics import *
from lazy import *
-
class Inc:
"""Class containing increment functions"""
def Increment_action(new, mirror, incpref):
@@ -322,3 +321,4 @@ from rpath import *
from robust import *
from rorpiter import *
import Globals, Time, MiscStats
+
diff --git a/rdiff-backup/src/lazy.py b/rdiff-backup/src/lazy.py
index f87a2b8..eddf63c 100644
--- a/rdiff-backup/src/lazy.py
+++ b/rdiff-backup/src/lazy.py
@@ -13,7 +13,7 @@
from __future__ import generators
import os, stat, types
from static import *
-
+import psyco
class Iter:
"""Hold static methods for the manipulation of lazy iterators"""
@@ -291,6 +291,8 @@ class IterTreeReducer:
self.index = index
return 1
+psyco.bind(IterTreeReducer)
+
class ITRBranch:
"""Helper class for IterTreeReducer below
@@ -355,4 +357,3 @@ class ITRBranch:
# Put at bottom to prevent (viciously) circular module dependencies
from robust import *
from log import *
-
diff --git a/rdiff-backup/src/robust.py b/rdiff-backup/src/robust.py
index 081aba3..7799b17 100644
--- a/rdiff-backup/src/robust.py
+++ b/rdiff-backup/src/robust.py
@@ -40,7 +40,6 @@ able to narrow down the possibilities.
import tempfile, errno, signal, cPickle, C
from static import *
-
class RobustAction:
"""Represents a file operation to be accomplished later"""
def __init__(self, init_thunk, final_func, error_handler):
diff --git a/rdiff-backup/src/rorpiter.py b/rdiff-backup/src/rorpiter.py
index 1e85d55..f566a4c 100644
--- a/rdiff-backup/src/rorpiter.py
+++ b/rdiff-backup/src/rorpiter.py
@@ -19,7 +19,6 @@ from robust import *
from iterfile import *
import Globals, Rdiff, Hardlink
-
class RORPIterException(Exception): pass
class RORPIter:
diff --git a/rdiff-backup/src/selection.py b/rdiff-backup/src/selection.py
index 6c59ccc..287d287 100644
--- a/rdiff-backup/src/selection.py
+++ b/rdiff-backup/src/selection.py
@@ -283,7 +283,7 @@ class Select:
elif opt == "--include-regexp":
self.add_selection_func(self.regexp_get_sf(arg, 1))
else: assert 0, "Bad selection option %s" % opt
- except SelectError, e: self.parse_catch_error(e)
+ except IOError: pass#SelectError, e: self.parse_catch_error(e)
assert filelists_index == len(filelists)
self.parse_last_excludes()