diff options
author | Zhiguang Li <muzili@gmail.com> | 2013-03-15 10:32:10 +0800 |
---|---|---|
committer | Chirayu Desai <cdesai@cyanogenmod.org> | 2013-04-29 16:19:26 +0530 |
commit | a8864fba9fd21f412cd0e2c6e072deeb204049bb (patch) | |
tree | 70008b8438542ff08fc9c5883e1b35f15c12b1c8 /subcmds/list.py | |
parent | 275e4b727a68cbf32c686d80736772c843771d98 (diff) | |
download | git-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 'subcmds/list.py')
-rw-r--r-- | subcmds/list.py | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/subcmds/list.py b/subcmds/list.py index 8eb06cdd..a3358245 100644 --- a/subcmds/list.py +++ b/subcmds/list.py | |||
@@ -14,7 +14,6 @@ | |||
14 | # limitations under the License. | 14 | # limitations under the License. |
15 | 15 | ||
16 | from __future__ import print_function | 16 | from __future__ import print_function |
17 | import re | ||
18 | import sys | 17 | import sys |
19 | 18 | ||
20 | from command import Command, MirrorSafeCommand | 19 | from command import Command, MirrorSafeCommand |
@@ -83,14 +82,3 @@ This is similar to running: repo forall -c 'echo "$REPO_PATH : $REPO_PROJECT"'. | |||
83 | 82 | ||
84 | lines.sort() | 83 | lines.sort() |
85 | print('\n'.join(lines)) | 84 | print('\n'.join(lines)) |
86 | |||
87 | def FindProjects(self, args): | ||
88 | result = [] | ||
89 | for project in self.GetProjects(''): | ||
90 | for arg in args: | ||
91 | pattern = re.compile(r'%s' % arg, re.IGNORECASE) | ||
92 | if pattern.search(project.name) or pattern.search(project.relpath): | ||
93 | result.append(project) | ||
94 | break | ||
95 | result.sort(key=lambda project: project.relpath) | ||
96 | return result | ||