summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordgaudet <dgaudet@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2007-01-29 17:38:58 +0000
committerdgaudet <dgaudet@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2007-01-29 17:38:58 +0000
commit753a094e5ec3b1e1df86090e891edb81769c61d8 (patch)
tree4af28492ec8aca9540179b6342902961bb657d0c
parentd79facba72670e9233b40867a9ad1795ddefd80c (diff)
downloadrdiff-backup-753a094e5ec3b1e1df86090e891edb81769c61d8.tar.gz
Glob escaping support via backslash. (Andrew Price)
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@786 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG6
-rw-r--r--rdiff-backup/rdiff-backup.19
-rw-r--r--rdiff-backup/rdiff_backup/selection.py7
3 files changed, 20 insertions, 2 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 33d7c48..f4daaa3 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -1,3 +1,9 @@
+New in v1.1.9 (????/??/??)
+--------------------------
+
+Glob escaping support via backslash. (Andrew Price)
+
+
New in v1.1.8 (2007/01/29)
--------------------------
diff --git a/rdiff-backup/rdiff-backup.1 b/rdiff-backup/rdiff-backup.1
index bd93703..a6725f0 100644
--- a/rdiff-backup/rdiff-backup.1
+++ b/rdiff-backup/rdiff-backup.1
@@ -738,6 +738,15 @@ insensitive), then this prefix will be removed and any character in
the string can be replaced with an upper- or lowercase version of
itself.
+If you need to match filenames which contain the above globbing
+characters, they may be escaped using a backslash "\\". The backslash
+will only escape the character following it so for
+.B **
+you will need
+to use "\\*\\*" to avoid escaping it to the
+.B *
+globbing character.
+
Remember that you may need to quote these characters when typing them
into a shell, so the shell does not interpret the globbing patterns
before rdiff-backup sees them.
diff --git a/rdiff-backup/rdiff_backup/selection.py b/rdiff-backup/rdiff_backup/selection.py
index 96b53aa..47bc1ef 100644
--- a/rdiff-backup/rdiff_backup/selection.py
+++ b/rdiff-backup/rdiff_backup/selection.py
@@ -77,7 +77,7 @@ class Select:
"""
# This re should not match normal filenames, but usually just globs
- glob_re = re.compile("(.*[*?[]|ignorecase\\:)", re.I | re.S)
+ glob_re = re.compile("(.*[*?[\\\\]|ignorecase\\:)", re.I | re.S)
def __init__(self, rootrp):
"""Select initializer. rpath is the root directory"""
@@ -640,7 +640,10 @@ probably isn't what you meant.""" %
while i < n:
c, s = pat[i], pat[i:i+2]
i = i+1
- if s == '**':
+ if c == '\\':
+ res = res + re.escape(s[-1])
+ i = i + 1
+ elif s == '**':
res = res + '.*'
i = i + 1
elif c == '*': res = res + '[^/]*'