Commit 6d8b3ca5 authored by dgaudet's avatar dgaudet

New --exclude-if-present option (i.e. --exclude-if-present .nobackup).

(Jeff Strunk).


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@797 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent e0591f94
New in v1.1.10 (????/??/??)
---------------------------
New --exclude-if-present option (i.e. --exclude-if-present .nobackup).
(Jeff Strunk).
Use signal 0 rather than signal.NSIG when testing if another rdiff-backup
is still running. (Patch from Sébastien Maret)
......
......@@ -190,6 +190,12 @@ Exclude all socket files.
.B "\-\-exclude-symbolic-links"
Exclude all symbolic links.
.TP
.BI "\-\exclude-if-present " filename
Exclude directories if
.IR filename
is present. This option needs to come before any other include or
exclude options.
.TP
.B \-\-force
Authorize a more drastic modification of a directory than usual (for
instance, when overwriting of a destination path, or when removing
......
......@@ -67,7 +67,7 @@ def parse_cmdlineoptions(arglist):
"exclude-symbolic-links", "exclude-sockets",
"exclude-filelist-stdin", "exclude-globbing-filelist=",
"exclude-globbing-filelist-stdin", "exclude-mirror=",
"exclude-other-filesystems", "exclude-regexp=",
"exclude-other-filesystems", "exclude-regexp=", "exclude-if-present=",
"exclude-special-files", "force", "group-mapping-file=",
"include=", "include-filelist=", "include-filelist-stdin",
"include-globbing-filelist=",
......@@ -109,6 +109,7 @@ def parse_cmdlineoptions(arglist):
opt == "--exclude-fifos" or
opt == "--exclude-other-filesystems" or
opt == "--exclude-regexp" or
opt == "--exclude-if-present" or
opt == "--exclude-special-files" or
opt == "--exclude-sockets" or
opt == "--exclude-symbolic-links"):
......
......@@ -234,6 +234,8 @@ class Select:
for opt, arg in argtuples:
if opt == "--exclude":
self.add_selection_func(self.glob_get_sf(arg, 0))
elif opt == "--exclude-if-present":
self.add_selection_func(self.presence_get_sf(arg, 0))
elif opt == "--exclude-device-files":
self.add_selection_func(self.devfiles_get_sf(0))
elif opt == "--exclude-symbolic-links":
......@@ -471,6 +473,18 @@ probably isn't what you meant.""" %
sel_func.name = "Regular expression: %s" % regexp_string
return sel_func
def presence_get_sf(self, presence_filename, include):
"""Return selection function given by a file if present"""
assert include == 0 or include == 1
def sel_func(rp):
if rp.isdir() and rp.readable() and rp.append(presence_filename).isreg(): return include
return None
sel_func.exclude = not include
sel_func.name = "Presence file: %s" % presence_filename
return sel_func
def gen_get_sf(self, pred, include, name):
"""Returns a selection function that uses pred to test
......
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