Commit 1c34df03 authored by bescoto's avatar bescoto

Keith Edmunds's patch adding --create-full-path


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@601 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 5b82843b
...@@ -33,6 +33,9 @@ from Daniel Westermann-Clark. ...@@ -33,6 +33,9 @@ from Daniel Westermann-Clark.
Log EACCES from listxattr rather than raising an exception -- this can happen Log EACCES from listxattr rather than raising an exception -- this can happen
when the repository has permission problems. when the repository has permission problems.
Added Keith Edmunds patch adding the --create-full-path option.
New in v0.13.6 (2005/04/07) New in v0.13.6 (2005/04/07)
--------------------------- ---------------------------
......
...@@ -84,6 +84,14 @@ Compare a directory with the backup set at the given time. This can ...@@ -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 be useful to see how archived data differs from current data, or to
check that a backup is current. check that a backup is current.
.TP .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 .BI "--current-time " seconds
This option is useful mainly for testing. If set, rdiff-backup will This option is useful mainly for testing. If set, rdiff-backup will
it for the current time instead of consulting the clock. The argument it for the current time instead of consulting the clock. The argument
......
...@@ -28,6 +28,7 @@ import Globals, Time, SetConnections, selection, robust, rpath, \ ...@@ -28,6 +28,7 @@ import Globals, Time, SetConnections, selection, robust, rpath, \
action = None action = None
create_full_path = None
remote_cmd, remote_schema = None, None remote_cmd, remote_schema = None, None
force = None force = None
select_opts = [] select_opts = []
...@@ -40,8 +41,8 @@ return_val = None # Set to cause exit code to be specified value ...@@ -40,8 +41,8 @@ return_val = None # Set to cause exit code to be specified value
def parse_cmdlineoptions(arglist): def parse_cmdlineoptions(arglist):
"""Parse argument list and set global preferences""" """Parse argument list and set global preferences"""
global args, action, force, restore_timestr, remote_cmd, remote_schema global args, action, create_full_path, force, restore_timestr, remote_cmd
global remove_older_than_string global remote_schema, remove_older_than_string
global user_mapping_filename, group_mapping_filename global user_mapping_filename, group_mapping_filename
def sel_fl(filename): def sel_fl(filename):
"""Helper function for including/excluding filelists below""" """Helper function for including/excluding filelists below"""
...@@ -54,11 +55,11 @@ def parse_cmdlineoptions(arglist): ...@@ -54,11 +55,11 @@ def parse_cmdlineoptions(arglist):
try: optlist, args = getopt.getopt(arglist, "blr:sv:V", try: optlist, args = getopt.getopt(arglist, "blr:sv:V",
["backup-mode", "calculate-average", "check-destination-dir", ["backup-mode", "calculate-average", "check-destination-dir",
"compare", "compare-at-time=", "current-time=", "exclude=", "compare", "compare-at-time=", "create-full-path",
"exclude-device-files", "exclude-fifos", "current-time=", "exclude=", "exclude-device-files",
"exclude-filelist=", "exclude-symbolic-links", "exclude-fifos", "exclude-filelist=",
"exclude-sockets", "exclude-filelist-stdin", "exclude-symbolic-links", "exclude-sockets",
"exclude-globbing-filelist=", "exclude-filelist-stdin", "exclude-globbing-filelist=",
"exclude-globbing-filelist-stdin", "exclude-mirror=", "exclude-globbing-filelist-stdin", "exclude-mirror=",
"exclude-other-filesystems", "exclude-regexp=", "exclude-other-filesystems", "exclude-regexp=",
"exclude-special-files", "force", "group-mapping-file=", "exclude-special-files", "force", "group-mapping-file=",
...@@ -88,6 +89,7 @@ def parse_cmdlineoptions(arglist): ...@@ -88,6 +89,7 @@ def parse_cmdlineoptions(arglist):
action = "compare" action = "compare"
if opt == "--compare": restore_timestr = "now" if opt == "--compare": restore_timestr = "now"
else: restore_timestr = arg else: restore_timestr = arg
elif opt == "--create-full-path": create_full_path = 1
elif opt == "--current-time": elif opt == "--current-time":
Globals.set_integer('current_time', arg) Globals.set_integer('current_time', arg)
elif (opt == "--exclude" or elif (opt == "--exclude" or
...@@ -325,7 +327,9 @@ def backup_check_dirs(rpin, rpout): ...@@ -325,7 +327,9 @@ def backup_check_dirs(rpin, rpout):
Log("Deleting %s" % rpout.path, 3) Log("Deleting %s" % rpout.path, 3)
rpout.delete() rpout.delete()
if not rpout.lstat(): if not rpout.lstat():
try: rpout.mkdir() try:
if create_full_path: rpout.makedirs()
else: rpout.mkdir()
except os.error: except os.error:
Log.FatalError("Unable to create directory %s" % rpout.path) Log.FatalError("Unable to create directory %s" % rpout.path)
......
...@@ -776,6 +776,11 @@ class RPath(RORPath): ...@@ -776,6 +776,11 @@ class RPath(RORPath):
self.conn.os.mkdir(self.path) self.conn.os.mkdir(self.path)
self.setdata() self.setdata()
def makedirs(self):
log.Log("Making directory path " + self.path, 6)
self.conn.os.makedirs(self.path)
self.setdata()
def rmdir(self): def rmdir(self):
log.Log("Removing directory " + self.path, 6) log.Log("Removing directory " + self.path, 6)
self.conn.os.rmdir(self.path) self.conn.os.rmdir(self.path)
......
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