summaryrefslogtreecommitdiffstats
path: root/subcmds/forall.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/forall.py')
-rw-r--r--subcmds/forall.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/subcmds/forall.py b/subcmds/forall.py
index 96dc99d1..07ee8d58 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -120,6 +120,9 @@ without iterating through the remaining projects.
120 p.add_option('-r', '--regex', 120 p.add_option('-r', '--regex',
121 dest='regex', action='store_true', 121 dest='regex', action='store_true',
122 help="Execute the command only on projects matching regex or wildcard expression") 122 help="Execute the command only on projects matching regex or wildcard expression")
123 p.add_option('-i', '--inverse-regex',
124 dest='inverse_regex', action='store_true',
125 help="Execute the command only on projects not matching regex or wildcard expression")
123 p.add_option('-g', '--groups', 126 p.add_option('-g', '--groups',
124 dest='groups', 127 dest='groups',
125 help="Execute the command only on projects matching the specified groups") 128 help="Execute the command only on projects matching the specified groups")
@@ -215,10 +218,12 @@ without iterating through the remaining projects.
215 if os.path.isfile(smart_sync_manifest_path): 218 if os.path.isfile(smart_sync_manifest_path):
216 self.manifest.Override(smart_sync_manifest_path) 219 self.manifest.Override(smart_sync_manifest_path)
217 220
218 if not opt.regex: 221 if opt.regex:
219 projects = self.GetProjects(args, groups=opt.groups)
220 else:
221 projects = self.FindProjects(args) 222 projects = self.FindProjects(args)
223 elif opt.inverse_regex:
224 projects = self.FindProjects(args, inverse=True)
225 else:
226 projects = self.GetProjects(args, groups=opt.groups)
222 227
223 os.environ['REPO_COUNT'] = str(len(projects)) 228 os.environ['REPO_COUNT'] = str(len(projects))
224 229
@@ -240,7 +245,8 @@ without iterating through the remaining projects.
240 rc = rc or errno.EINTR 245 rc = rc or errno.EINTR
241 except Exception as e: 246 except Exception as e:
242 # Catch any other exceptions raised 247 # Catch any other exceptions raised
243 print('Got an error, terminating the pool: %r' % e, 248 print('Got an error, terminating the pool: %s: %s' %
249 (type(e).__name__, e),
244 file=sys.stderr) 250 file=sys.stderr)
245 pool.terminate() 251 pool.terminate()
246 rc = rc or getattr(e, 'errno', 1) 252 rc = rc or getattr(e, 'errno', 1)
@@ -254,7 +260,8 @@ without iterating through the remaining projects.
254 try: 260 try:
255 project = self._SerializeProject(p) 261 project = self._SerializeProject(p)
256 except Exception as e: 262 except Exception as e:
257 print('Project list error: %r' % e, 263 print('Project list error on project %s: %s: %s' %
264 (p.name, type(e).__name__, e),
258 file=sys.stderr) 265 file=sys.stderr)
259 return 266 return
260 except KeyboardInterrupt: 267 except KeyboardInterrupt: