Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(732)

Side by Side Diff: gclient.py

Issue 9600010: Add --ignore to gclient recurse (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Meta checkout manager supporting both Subversion and GIT. 6 """Meta checkout manager supporting both Subversion and GIT.
7 7
8 Files 8 Files
9 .gclient : Current client configuration, written by 'config' command. 9 .gclient : Current client configuration, written by 'config' command.
10 Format is a Python script defining 'solutions', a list whose 10 Format is a Python script defining 'solutions', a list whose
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 scm = gclient_scm.GetScmName(parsed_url) 571 scm = gclient_scm.GetScmName(parsed_url)
572 if not options.scm or scm in options.scm: 572 if not options.scm or scm in options.scm:
573 cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name)) 573 cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name))
574 # Pass in the SCM type as an env variable 574 # Pass in the SCM type as an env variable
575 env = os.environ.copy() 575 env = os.environ.copy()
576 if scm: 576 if scm:
577 env['GCLIENT_SCM'] = scm 577 env['GCLIENT_SCM'] = scm
578 if parsed_url: 578 if parsed_url:
579 env['GCLIENT_URL'] = parsed_url 579 env['GCLIENT_URL'] = parsed_url
580 if os.path.isdir(cwd): 580 if os.path.isdir(cwd):
581 gclient_utils.CheckCallAndFilter( 581 try:
582 args, cwd=cwd, env=env, print_stdout=True) 582 gclient_utils.CheckCallAndFilter(
583 args, cwd=cwd, env=env, print_stdout=True)
584 except subprocess2.CalledProcessError:
585 if not options.ignore:
586 raise
583 else: 587 else:
584 print >> sys.stderr, 'Skipped missing %s' % cwd 588 print >> sys.stderr, 'Skipped missing %s' % cwd
585 589
586 # Always parse the DEPS file. 590 # Always parse the DEPS file.
587 self.ParseDepsFile() 591 self.ParseDepsFile()
588 592
589 self._run_is_done(file_list, parsed_url) 593 self._run_is_done(file_list, parsed_url)
590 594
591 if self.recursion_limit: 595 if self.recursion_limit:
592 # Parse the dependencies of this dependency. 596 # Parse the dependencies of this dependency.
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 @attr('usage', '[command] [args ...]') 1151 @attr('usage', '[command] [args ...]')
1148 def CMDrecurse(parser, args): 1152 def CMDrecurse(parser, args):
1149 """Operates on all the entries. 1153 """Operates on all the entries.
1150 1154
1151 Runs a shell command on all entries. 1155 Runs a shell command on all entries.
1152 """ 1156 """
1153 # Stop parsing at the first non-arg so that these go through to the command 1157 # Stop parsing at the first non-arg so that these go through to the command
1154 parser.disable_interspersed_args() 1158 parser.disable_interspersed_args()
1155 parser.add_option('-s', '--scm', action='append', default=[], 1159 parser.add_option('-s', '--scm', action='append', default=[],
1156 help='choose scm types to operate upon') 1160 help='choose scm types to operate upon')
1161 parser.add_option('-i', '--ignore', action='store_true',
1162 help='continue processing in case of non zero return code')
1157 options, args = parser.parse_args(args) 1163 options, args = parser.parse_args(args)
1158 if not args: 1164 if not args:
1159 print >> sys.stderr, 'Need to supply a command!' 1165 print >> sys.stderr, 'Need to supply a command!'
1160 return 1 1166 return 1
1161 root_and_entries = gclient_utils.GetGClientRootAndEntries() 1167 root_and_entries = gclient_utils.GetGClientRootAndEntries()
1162 if not root_and_entries: 1168 if not root_and_entries:
1163 print >> sys.stderr, ( 1169 print >> sys.stderr, (
1164 'You need to run gclient sync at least once to use \'recurse\'.\n' 1170 'You need to run gclient sync at least once to use \'recurse\'.\n'
1165 'This is because .gclient_entries needs to exist and be up to date.') 1171 'This is because .gclient_entries needs to exist and be up to date.')
1166 return 1 1172 return 1
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 1565 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
1560 print >> sys.stderr, 'Error: %s' % str(e) 1566 print >> sys.stderr, 'Error: %s' % str(e)
1561 return 1 1567 return 1
1562 1568
1563 1569
1564 if '__main__' == __name__: 1570 if '__main__' == __name__:
1565 fix_encoding.fix_encoding() 1571 fix_encoding.fix_encoding()
1566 sys.exit(Main(sys.argv[1:])) 1572 sys.exit(Main(sys.argv[1:]))
1567 1573
1568 # vim: ts=2:sw=2:tw=80:et: 1574 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698