mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-02-23 23:27:27 +08:00
Merge "Optimise regex pattern compilation in FindProjects"
This commit is contained in:
commit
45401230cf
@ -188,9 +188,9 @@ class Command(object):
|
|||||||
|
|
||||||
def FindProjects(self, args):
|
def FindProjects(self, args):
|
||||||
result = []
|
result = []
|
||||||
|
patterns = [re.compile(r'%s' % a, re.IGNORECASE) for a in args]
|
||||||
for project in self.GetProjects(''):
|
for project in self.GetProjects(''):
|
||||||
for arg in args:
|
for pattern in patterns:
|
||||||
pattern = re.compile(r'%s' % arg, re.IGNORECASE)
|
|
||||||
if pattern.search(project.name) or pattern.search(project.relpath):
|
if pattern.search(project.name) or pattern.search(project.relpath):
|
||||||
result.append(project)
|
result.append(project)
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user