return re.sub(ur'@[_@]', lambda m: {u'@_': u'/', u'@@': u'@'}[m.group(0)], path)
-IGNORE_SUFFIXES = ['.backup', '.tmp', '.conflicted']
-IGNORE_PREFIXES = ['.']
+IGNORE_SUFFIXES = [u'.backup', u'.tmp', u'.conflicted']
+IGNORE_PREFIXES = [u'.']
def should_ignore_file(path_u):
for suffix in IGNORE_SUFFIXES:
if path_u.endswith(suffix):
return True
- while True:
- head, tail = os.path.split(path_u)
- if tail != "":
- for prefix in IGNORE_PREFIXES:
- if tail.startswith(prefix):
- return True
- else:
- path_u = head
- else:
- if head == "":
- return False
+ while path_u != u"":
+ path_u, tail_u = os.path.split(path_u)
+ if tail_u.startswith(u"."):
+ return True
return False