Merge "Optimise regex pattern compilation in FindProjects"
diff --git a/command.py b/command.py
index 66a9e74..287f4d3 100644
--- a/command.py
+++ b/command.py
@@ -188,9 +188,9 @@
def FindProjects(self, args):
result = []
+ patterns = [re.compile(r'%s' % a, re.IGNORECASE) for a in args]
for project in self.GetProjects(''):
- for arg in args:
- pattern = re.compile(r'%s' % arg, re.IGNORECASE)
+ for pattern in patterns:
if pattern.search(project.name) or pattern.search(project.relpath):
result.append(project)
break