Commit fdf9dbfc authored by dgaudet's avatar dgaudet

--min-file-size/--max-file-size support. (Patch from Wout Mertens.)


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@761 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 8169f6d3
New in v1.1.6 (????/??/??) New in v1.1.6 (????/??/??)
-------------------------- --------------------------
--min-file-size/--max-file-size support. (Patch from Wout Mertens.)
Mac OS X Extended Attributes support. (Patch from Andrew Ferguson.) Mac OS X Extended Attributes support. (Patch from Andrew Ferguson.)
Preserve Mac OS X 'Creation Date' field across backups. (Patch from Andrew Preserve Mac OS X 'Creation Date' field across backups. (Patch from Andrew
......
...@@ -283,6 +283,12 @@ to \-\-remove-older-than. Specifying a subdirectory is allowable; then ...@@ -283,6 +283,12 @@ to \-\-remove-older-than. Specifying a subdirectory is allowable; then
only the sizes of the mirror and increments pertaining to that only the sizes of the mirror and increments pertaining to that
subdirectory will be listed. subdirectory will be listed.
.TP .TP
.BI "\-\-max-file-size " size
Exclude files that are larger than the given size in bytes
.TP
.BI "\-\-min-file-size " size
Exclude files that are smaller than the given size in bytes
.TP
.B \-\-never-drop-acls .B \-\-never-drop-acls
Exit with error instead of dropping acls or acl entries. Normally Exit with error instead of dropping acls or acl entries. Normally
this may happen (with a warning) because the destination does not this may happen (with a warning) because the destination does not
......
...@@ -75,6 +75,7 @@ def parse_cmdlineoptions(arglist): ...@@ -75,6 +75,7 @@ def parse_cmdlineoptions(arglist):
"include-special-files", "include-symbolic-links", "include-special-files", "include-symbolic-links",
"list-at-time=", "list-changed-since=", "list-increments", "list-at-time=", "list-changed-since=", "list-increments",
"list-increment-sizes", "never-drop-acls", "list-increment-sizes", "never-drop-acls",
"max-file-size=", "min-file-size=",
"no-acls", "no-carbonfile", "no-acls", "no-carbonfile",
"no-compare-inode", "no-compression", "no-compression-regexp=", "no-compare-inode", "no-compression", "no-compression-regexp=",
"no-eas", "no-file-statistics", "no-hard-links", "null-separator", "no-eas", "no-file-statistics", "no-hard-links", "null-separator",
...@@ -152,6 +153,8 @@ def parse_cmdlineoptions(arglist): ...@@ -152,6 +153,8 @@ def parse_cmdlineoptions(arglist):
elif opt == "-l" or opt == "--list-increments": elif opt == "-l" or opt == "--list-increments":
action = "list-increments" action = "list-increments"
elif opt == '--list-increment-sizes': action = 'list-increment-sizes' elif opt == '--list-increment-sizes': action = 'list-increment-sizes'
elif opt == "--max-file-size": select_opts.append((opt, arg))
elif opt == "--min-file-size": select_opts.append((opt, arg))
elif opt == "--never-drop-acls": Globals.set("never_drop_acls", 1) elif opt == "--never-drop-acls": Globals.set("never_drop_acls", 1)
elif opt == "--no-acls": Globals.set("acls_active", 0) elif opt == "--no-acls": Globals.set("acls_active", 0)
elif opt == "--no-carbonfile": Globals.set("carbonfile_active", 0) elif opt == "--no-carbonfile": Globals.set("carbonfile_active", 0)
......
...@@ -274,6 +274,10 @@ class Select: ...@@ -274,6 +274,10 @@ class Select:
self.add_selection_func(self.special_get_sf(1)) self.add_selection_func(self.special_get_sf(1))
elif opt == "--include-symbolic-links": elif opt == "--include-symbolic-links":
self.add_selection_func(self.symlinks_get_sf(1)) self.add_selection_func(self.symlinks_get_sf(1))
elif opt == "--max-file-size":
self.add_selection_func(self.size_get_sf(1, arg))
elif opt == "--min-file-size":
self.add_selection_func(self.size_get_sf(0, arg))
else: assert 0, "Bad selection option %s" % opt else: assert 0, "Bad selection option %s" % opt
except SelectError, e: self.parse_catch_error(e) except SelectError, e: self.parse_catch_error(e)
assert filelists_index == len(filelists) assert filelists_index == len(filelists)
...@@ -507,6 +511,16 @@ probably isn't what you meant.""" % ...@@ -507,6 +511,16 @@ probably isn't what you meant.""" %
sel_func.name = (include and "include" or "exclude") + " special files" sel_func.name = (include and "include" or "exclude") + " special files"
return sel_func return sel_func
def size_get_sf(self, min_max, sizestr):
"""Return selection function given by filesize"""
size = int(sizestr)
assert size > 0
if min_max: sel_func = lambda rp: (rp.getsize() <= size)
else: sel_func = lambda rp: (rp.getsize() >= size)
sel_func.exclude = 1
sel_func.name = "%s size %d" % (min_max and "Maximum" or "Minimum", size)
return sel_func
def glob_get_sf(self, glob_str, include): def glob_get_sf(self, glob_str, include):
"""Return selection function given by glob string""" """Return selection function given by glob string"""
assert include == 0 or include == 1 assert include == 0 or include == 1
......
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