summaryrefslogtreecommitdiffstats
path: root/command.py
diff options
context:
space:
mode:
authorZhiguang Li <muzili@gmail.com>2013-03-15 10:32:10 +0800
committerChirayu Desai <cdesai@cyanogenmod.org>2013-04-29 16:19:26 +0530
commita8864fba9fd21f412cd0e2c6e072deeb204049bb (patch)
tree70008b8438542ff08fc9c5883e1b35f15c12b1c8 /command.py
parent275e4b727a68cbf32c686d80736772c843771d98 (diff)
downloadgit-repo-a8864fba9fd21f412cd0e2c6e072deeb204049bb.tar.gz
Add regex support for subcommand forall
Filter the project list based on regex or wildcard matching of strings, then we can handle subset of all projects. Change-Id: Ib6c23aec79e7d981f7b6a5eb0ae93c44effec467 Signed-off-by: Zhiguang Li <muzili@gmail.com>
Diffstat (limited to 'command.py')
-rw-r--r--command.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/command.py b/command.py
index 959805a2..66a9e74d 100644
--- a/command.py
+++ b/command.py
@@ -186,6 +186,17 @@ class Command(object):
186 result.sort(key=_getpath) 186 result.sort(key=_getpath)
187 return result 187 return result
188 188
189 def FindProjects(self, args):
190 result = []
191 for project in self.GetProjects(''):
192 for arg in args:
193 pattern = re.compile(r'%s' % arg, re.IGNORECASE)
194 if pattern.search(project.name) or pattern.search(project.relpath):
195 result.append(project)
196 break
197 result.sort(key=lambda project: project.relpath)
198 return result
199
189# pylint: disable=W0223 200# pylint: disable=W0223
190# Pylint warns that the `InteractiveCommand` and `PagedCommand` classes do not 201# Pylint warns that the `InteractiveCommand` and `PagedCommand` classes do not
191# override method `Execute` which is abstract in `Command`. Since that method 202# override method `Execute` which is abstract in `Command`. Since that method