Comments
Patch
@@ -11,15 +11,16 @@ import re
_commentre = None
-def ignorepats(lines):
- '''parse lines (iterable) of .hgignore text, returning a tuple of
- (patterns, parse errors). These patterns should be given to compile()
+def readignorefile(filepath):
+ '''parse a pattern file, returning a list of
+ patterns. These patterns should be given to compile()
to be validated and converted into a match function.'''
syntaxes = {'re': 'relre:', 'regexp': 'relre:', 'glob': 'relglob:'}
syntax = 'relre:'
patterns = []
- for line in lines:
+ fp = open(filepath)
+ for line in fp:
if "#" in line:
global _commentre
if not _commentre:
@@ -51,15 +52,9 @@ def ignorepats(lines):
line = line[len(s) + 1:]
break
patterns.append(linesyntax + line)
-
+ fp.close()
return patterns
-def readignorefile(filepath):
- fp = open(filepath)
- pats = ignorepats(fp)
- fp.close()
- return pats
-
def readpats(root, files, warn):
'''return a dict mapping ignore-file-name to list-of-patterns'''