1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-24 08:45:13 +00:00

add a string representation for Include/ExcludePattern

it just gives the original string that was used.
This commit is contained in:
Thomas Waldmann 2015-09-19 18:03:53 +02:00
parent 08417b52ec
commit 15b003e344

View file

@ -250,6 +250,7 @@ class IncludePattern:
path match as well. A trailing slash makes no difference.
"""
def __init__(self, pattern):
self.pattern_orig = pattern
self.match_count = 0
if sys.platform in ('darwin',):
@ -267,12 +268,16 @@ def match(self, path):
def __repr__(self):
return '%s(%s)' % (type(self), self.pattern)
def __str__(self):
return self.pattern_orig
class ExcludePattern(IncludePattern):
"""Shell glob patterns to exclude. A trailing slash means to
exclude the contents of a directory, but not the directory itself.
"""
def __init__(self, pattern):
self.pattern_orig = pattern
self.match_count = 0
if pattern.endswith(os.path.sep):
@ -297,6 +302,9 @@ def match(self, path):
def __repr__(self):
return '%s(%s)' % (type(self), self.pattern)
def __str__(self):
return self.pattern_orig
def timestamp(s):
"""Convert a --timestamp=s argument to a datetime object"""