Mercurial > public > mercurial-scm > hg-stable
diff mercurial/match.py @ 25216:dc562165044a
ignore: use 'include:' rules instead of custom syntax
Now that the matcher supports 'include:' rules, let's change the dirstate.ignore
creation to just create a matcher with a bunch of includes. This allows us to
completely delete ignore.py.
I moved some of the syntax documentation over to readpatternfile in match.py so
we don't lose it.
author | Durham Goode <durham@fb.com> |
---|---|
date | Sat, 16 May 2015 16:06:22 -0700 |
parents | 4040e06e9b99 |
children | 8545bd381504 |
line wrap: on
line diff
--- a/mercurial/match.py Sat May 16 15:56:52 2015 -0700 +++ b/mercurial/match.py Sat May 16 16:06:22 2015 -0700 @@ -528,7 +528,21 @@ def readpatternfile(filepath, warn): '''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.''' + to be validated and converted into a match function. + + trailing white space is dropped. + the escape character is backslash. + comments start with #. + empty lines are skipped. + + lines can be of the following formats: + + syntax: regexp # defaults following lines to non-rooted regexps + syntax: glob # defaults following lines to non-rooted globs + re:pattern # non-rooted regular expression + glob:pattern # non-rooted glob + pattern # pattern of the current default type''' + syntaxes = {'re': 'relre:', 'regexp': 'relre:', 'glob': 'relglob:', 'include': 'include'} syntax = 'relre:'