Commit 4a4f5445 authored by dgaudet's avatar dgaudet

Glob escaping support via backslash. (Andrew Price)


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@786 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 6cae2a61
New in v1.1.9 (????/??/??)
--------------------------
Glob escaping support via backslash. (Andrew Price)
New in v1.1.8 (2007/01/29)
--------------------------
......
......@@ -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.
......
......@@ -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 + '[^/]*'
......
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