Browse Source

add a string representation for Include/ExcludePattern

it just gives the original string that was used.
Thomas Waldmann 9 years ago
parent
commit
15b003e344
1 changed files with 8 additions and 0 deletions
  1. 8 0
      borg/helpers.py

+ 8 - 0
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"""