From 288054dae120483c06c78056d64478a8ce113f3f Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Mon, 5 Mar 2012 00:43:07 +0000 Subject: [PATCH] Add --ignore to gclient recurse This permits running git grep over the dependencies. With --ignore, gclient recurse continues even if nothing is found in a dependency. Without this flag, git grep returns 1 when nothing is found, causing gclient to stop processing the remaining dependencies. TBR=nsylvain@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/9600010 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@124914 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gclient.py b/gclient.py index 0cfb26dd7d..3a4622ef6a 100644 --- a/gclient.py +++ b/gclient.py @@ -578,8 +578,12 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): if parsed_url: env['GCLIENT_URL'] = parsed_url if os.path.isdir(cwd): - gclient_utils.CheckCallAndFilter( - args, cwd=cwd, env=env, print_stdout=True) + try: + gclient_utils.CheckCallAndFilter( + args, cwd=cwd, env=env, print_stdout=True) + except subprocess2.CalledProcessError: + if not options.ignore: + raise else: print >> sys.stderr, 'Skipped missing %s' % cwd @@ -1154,6 +1158,8 @@ def CMDrecurse(parser, args): parser.disable_interspersed_args() parser.add_option('-s', '--scm', action='append', default=[], help='choose scm types to operate upon') + parser.add_option('-i', '--ignore', action='store_true', + help='continue processing in case of non zero return code') options, args = parser.parse_args(args) if not args: print >> sys.stderr, 'Need to supply a command!'