Mercurial > hg
comparison mercurial/context.py @ 32395:24245b54aa8a
match: replace match class by match function (API)
The matcher class is getting hard to understand. It will be easier to
follow if we can break it up into simpler matchers that we then
compose. I'm hoping to have one matcher that accepts regular
(non-include) patterns, one for exact file matches, one that always
matches (and maybe one that never does) and then compose them by
intersection and difference.
This patch takes a simple but important step towards that goal by
making match.match() a function (and renaming the matcher class itself
from "match" to "matcher"). The new function will eventually be
responsible for creating the simple matchers and composing them.
icasefsmatcher similarly gets a factory function (called
"icasefsmatch"). I also moved the other factory functions nearby.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 12 May 2017 23:11:41 -0700 |
parents | 81936f6462c1 |
children | 284b18303f61 |
comparison
equal
deleted
inserted
replaced
32394:38a2b9d90131 | 32395:24245b54aa8a |
---|---|
1593 | 1593 |
1594 # Only a case insensitive filesystem needs magic to translate user input | 1594 # Only a case insensitive filesystem needs magic to translate user input |
1595 # to actual case in the filesystem. | 1595 # to actual case in the filesystem. |
1596 matcherfunc = matchmod.match | 1596 matcherfunc = matchmod.match |
1597 if not util.fscasesensitive(r.root): | 1597 if not util.fscasesensitive(r.root): |
1598 matcherfunc = matchmod.icasefsmatcher | 1598 matcherfunc = matchmod.icasefsmatch |
1599 return matcherfunc(r.root, r.getcwd(), pats, | 1599 return matcherfunc(r.root, r.getcwd(), pats, |
1600 include, exclude, default, | 1600 include, exclude, default, |
1601 auditor=r.auditor, ctx=self, | 1601 auditor=r.auditor, ctx=self, |
1602 listsubrepos=listsubrepos, badfn=badfn) | 1602 listsubrepos=listsubrepos, badfn=badfn) |
1603 | 1603 |