Mercurial > hg
diff contrib/vagrant/Vagrantfile @ 22513:ca709785caf2
match: simplify brittle predicate construction
In match.__init__(), we create the matchfn predicate by and-ing
together the individual predicates for includes, excludes (negated)
and patterns. Instead of the current set of nested if/else blocks, we
can simplify by adding the predicates to a list and defining the
overall predicate in a generic way based on the components. We can
still optimize it for the 0-length and 1-length cases. This way, there
is no combinatorial explosion to deal with if new component predicates
are added, and there is less risk of getting the overall predicate
wrong.
author | Martin von Zweigbergk <martinvonz@gmail.com> |
---|---|
date | Fri, 19 Sep 2014 13:49:58 -0700 |
parents | 8da01b6e7b49 |
children | a31ffc445f02 |