From 1f0564406ba5aab11b21a83d193485ee6597f213 Mon Sep 17 00:00:00 2001 From: Takeshi Kanemoto Date: Tue, 26 Jan 2016 14:11:35 +0900 Subject: 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 --- subcmds/forall.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'subcmds/forall.py') diff --git a/subcmds/forall.py b/subcmds/forall.py index b10f34b3..07ee8d58 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py @@ -120,6 +120,9 @@ without iterating through the remaining projects. p.add_option('-r', '--regex', dest='regex', action='store_true', help="Execute the command only on projects matching regex or wildcard expression") + p.add_option('-i', '--inverse-regex', + dest='inverse_regex', action='store_true', + help="Execute the command only on projects not matching regex or wildcard expression") p.add_option('-g', '--groups', dest='groups', help="Execute the command only on projects matching the specified groups") @@ -215,10 +218,12 @@ without iterating through the remaining projects. if os.path.isfile(smart_sync_manifest_path): self.manifest.Override(smart_sync_manifest_path) - if not opt.regex: - projects = self.GetProjects(args, groups=opt.groups) - else: + if opt.regex: projects = self.FindProjects(args) + elif opt.inverse_regex: + projects = self.FindProjects(args, inverse=True) + else: + projects = self.GetProjects(args, groups=opt.groups) os.environ['REPO_COUNT'] = str(len(projects)) -- cgit v1.2.3-54-g00ecf