summaryrefslogtreecommitdiff
path: root/command.py
diff options
context:
space:
mode:
authorTakeshi Kanemoto <takeshi.kanemoto@sonymobile.com>2016-01-26 14:11:35 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2016-04-05 07:28:27 +0000
commit1f0564406ba5aab11b21a83d193485ee6597f213 (patch)
tree533f5c7a21032a634161c365f781efe8b340ecfc /command.py
parent936d6185eb9bb802a3b25982bc71c6bc58633f43 (diff)
downloadgit-repo-1f0564406ba5aab11b21a83d193485ee6597f213.tar.gz
git-repo-1f0564406ba5aab11b21a83d193485ee6597f213.zip
Add --inverse-regex option to forall subcommand
Make it possible to exclude projects using regex/wildcard. The syntax is similar to that of the -r option, e.g.: repo forall -i ^platform/ ^device/ -c 'echo $REPO_PROJECT' Change-Id: Id250de5665152228c044c79337d3ac15b5696484
Diffstat (limited to 'command.py')
-rw-r--r--command.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/command.py b/command.py
index 39dcf6c28..bc2f95010 100644
--- a/command.py
+++ b/command.py
@@ -193,14 +193,20 @@ class Command(object):
result.sort(key=_getpath)
return result
- def FindProjects(self, args):
+ def FindProjects(self, args, inverse=False):
result = []
patterns = [re.compile(r'%s' % a, re.IGNORECASE) for a in args]
for project in self.GetProjects(''):
for pattern in patterns:
- if pattern.search(project.name) or pattern.search(project.relpath):
+ match = pattern.search(project.name) or pattern.search(project.relpath)
+ if not inverse and match:
result.append(project)
break
+ if inverse and match:
+ break
+ else:
+ if inverse:
+ result.append(project)
result.sort(key=lambda project: project.relpath)
return result