From 15b003e344cfbad046f99eee9686fcb6dd85af5c Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 19 Sep 2015 18:03:53 +0200 Subject: [PATCH] add a string representation for Include/ExcludePattern it just gives the original string that was used. --- borg/helpers.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/borg/helpers.py b/borg/helpers.py index 820efa9ed..f9450c1b8 100644 --- a/borg/helpers.py +++ b/borg/helpers.py @@ -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 @@ class IncludePattern: 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 @@ class ExcludePattern(IncludePattern): 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"""