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>
This commit is contained in:
parent
275e4b727a
commit
a8864fba9f
3 changed files with 24 additions and 13 deletions
|
@ -14,7 +14,6 @@
|
|||
# limitations under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import sys
|
||||
|
||||
from command import Command, MirrorSafeCommand
|
||||
|
@ -83,14 +82,3 @@ This is similar to running: repo forall -c 'echo "$REPO_PATH : $REPO_PROJECT"'.
|
|||
|
||||
lines.sort()
|
||||
print('\n'.join(lines))
|
||||
|
||||
def FindProjects(self, args):
|
||||
result = []
|
||||
for project in self.GetProjects(''):
|
||||
for arg in args:
|
||||
pattern = re.compile(r'%s' % arg, re.IGNORECASE)
|
||||
if pattern.search(project.name) or pattern.search(project.relpath):
|
||||
result.append(project)
|
||||
break
|
||||
result.sort(key=lambda project: project.relpath)
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue