summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-08-08 03:53:50 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-08-08 03:53:50 +0000
commit54f02ea7da4223001b22e2f0b8c9427f1cdadd1b (patch)
treef71ef85f6855904485fd99dcc05ba7cf6183205f
parent867d5159b225602aa3e185fc66c73318d51ae3b0 (diff)
downloadrdiff-backup-54f02ea7da4223001b22e2f0b8c9427f1cdadd1b.tar.gz
Keith Edmunds's patch adding --create-full-path
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@601 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG3
-rw-r--r--rdiff-backup/rdiff-backup.18
-rw-r--r--rdiff-backup/rdiff_backup/Main.py20
-rw-r--r--rdiff-backup/rdiff_backup/rpath.py5
4 files changed, 28 insertions, 8 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 5f17688..ba54d5c 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -33,6 +33,9 @@ from Daniel Westermann-Clark.
Log EACCES from listxattr rather than raising an exception -- this can happen
when the repository has permission problems.
+Added Keith Edmunds patch adding the --create-full-path option.
+
+
New in v0.13.6 (2005/04/07)
---------------------------
diff --git a/rdiff-backup/rdiff-backup.1 b/rdiff-backup/rdiff-backup.1
index aebfab0..a6ad325 100644
--- a/rdiff-backup/rdiff-backup.1
+++ b/rdiff-backup/rdiff-backup.1
@@ -84,6 +84,14 @@ Compare a directory with the backup set at the given time. This can
be useful to see how archived data differs from current data, or to
check that a backup is current.
.TP
+.BI "--create-full-path"
+Normally only the final directory of the destination path will be
+created if it does not exist. With this option, all missing directories
+on the destination path will be created. Use this option with care: if
+there is a typo in the remote path, the remote filesystem could fill up
+very quickly (by creating a duplicate backup tree). For this reason
+this option is primarily aimed at scripts which automate backups.
+.TP
.BI "--current-time " seconds
This option is useful mainly for testing. If set, rdiff-backup will
it for the current time instead of consulting the clock. The argument
diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py
index 7ad5b42..c9ccc59 100644
--- a/rdiff-backup/rdiff_backup/Main.py
+++ b/rdiff-backup/rdiff_backup/Main.py
@@ -28,6 +28,7 @@ import Globals, Time, SetConnections, selection, robust, rpath, \
action = None
+create_full_path = None
remote_cmd, remote_schema = None, None
force = None
select_opts = []
@@ -40,8 +41,8 @@ return_val = None # Set to cause exit code to be specified value
def parse_cmdlineoptions(arglist):
"""Parse argument list and set global preferences"""
- global args, action, force, restore_timestr, remote_cmd, remote_schema
- global remove_older_than_string
+ global args, action, create_full_path, force, restore_timestr, remote_cmd
+ global remote_schema, remove_older_than_string
global user_mapping_filename, group_mapping_filename
def sel_fl(filename):
"""Helper function for including/excluding filelists below"""
@@ -54,11 +55,11 @@ def parse_cmdlineoptions(arglist):
try: optlist, args = getopt.getopt(arglist, "blr:sv:V",
["backup-mode", "calculate-average", "check-destination-dir",
- "compare", "compare-at-time=", "current-time=", "exclude=",
- "exclude-device-files", "exclude-fifos",
- "exclude-filelist=", "exclude-symbolic-links",
- "exclude-sockets", "exclude-filelist-stdin",
- "exclude-globbing-filelist=",
+ "compare", "compare-at-time=", "create-full-path",
+ "current-time=", "exclude=", "exclude-device-files",
+ "exclude-fifos", "exclude-filelist=",
+ "exclude-symbolic-links", "exclude-sockets",
+ "exclude-filelist-stdin", "exclude-globbing-filelist=",
"exclude-globbing-filelist-stdin", "exclude-mirror=",
"exclude-other-filesystems", "exclude-regexp=",
"exclude-special-files", "force", "group-mapping-file=",
@@ -88,6 +89,7 @@ def parse_cmdlineoptions(arglist):
action = "compare"
if opt == "--compare": restore_timestr = "now"
else: restore_timestr = arg
+ elif opt == "--create-full-path": create_full_path = 1
elif opt == "--current-time":
Globals.set_integer('current_time', arg)
elif (opt == "--exclude" or
@@ -325,7 +327,9 @@ def backup_check_dirs(rpin, rpout):
Log("Deleting %s" % rpout.path, 3)
rpout.delete()
if not rpout.lstat():
- try: rpout.mkdir()
+ try:
+ if create_full_path: rpout.makedirs()
+ else: rpout.mkdir()
except os.error:
Log.FatalError("Unable to create directory %s" % rpout.path)
diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py
index 3a292d7..deb25f4 100644
--- a/rdiff-backup/rdiff_backup/rpath.py
+++ b/rdiff-backup/rdiff_backup/rpath.py
@@ -776,6 +776,11 @@ class RPath(RORPath):
self.conn.os.mkdir(self.path)
self.setdata()
+ def makedirs(self):
+ log.Log("Making directory path " + self.path, 6)
+ self.conn.os.makedirs(self.path)
+ self.setdata()
+
def rmdir(self):
log.Log("Removing directory " + self.path, 6)
self.conn.os.rmdir(self.path)