[PATCH 2 of 5] match: break boolean expressions into one operand per line
Martin von Zweigbergk
martinvonz at google.com
Mon Jun 15 12:13:51 CDT 2015
# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1432744440 25200
# Wed May 27 09:34:00 2015 -0700
# Node ID 58744830c148bbc93e3947b8a7b9c85ecd320f0a
# Parent 66aff803f226fdf9cda773a195df02a676266fec
match: break boolean expressions into one operand per line
This makes it much easier to spot both the operators ('and'/'or') and
the operands.
diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -225,13 +225,16 @@
if dir in self._excluderoots:
return False
parentdirs = None
- if (self._includeroots and dir not in self._includeroots and
- dir not in self._includedirs):
+ if (self._includeroots and
+ dir not in self._includeroots and
+ dir not in self._includedirs):
parentdirs = list(util.finddirs(dir))
if not any(parent in self._includeroots for parent in parentdirs):
return False
- return (not self._fileroots or '.' in self._fileroots or
- dir in self._fileroots or dir in self._dirs or
+ return (not self._fileroots or
+ '.' in self._fileroots or
+ dir in self._fileroots or
+ dir in self._dirs or
any(parentdir in self._fileroots
for parentdir in parentdirs or util.finddirs(dir)))
More information about the Mercurial-devel
mailing list