OLD | NEW |
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 # Skip file only checkout. | 634 # Skip file only checkout. |
635 scm = gclient_scm.GetScmName(parsed_url) | 635 scm = gclient_scm.GetScmName(parsed_url) |
636 if not options.scm or scm in options.scm: | 636 if not options.scm or scm in options.scm: |
637 cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name)) | 637 cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name)) |
638 # Pass in the SCM type as an env variable | 638 # Pass in the SCM type as an env variable |
639 env = os.environ.copy() | 639 env = os.environ.copy() |
640 if scm: | 640 if scm: |
641 env['GCLIENT_SCM'] = scm | 641 env['GCLIENT_SCM'] = scm |
642 if parsed_url: | 642 if parsed_url: |
643 env['GCLIENT_URL'] = parsed_url | 643 env['GCLIENT_URL'] = parsed_url |
| 644 env['GCLIENT_DEP_PATH'] = self.name |
644 if options.prepend_dir: | 645 if options.prepend_dir: |
645 print_stdout = False | 646 print_stdout = False |
646 def filter_fn(line): | 647 def filter_fn(line): |
647 items = line.split('\0') | 648 items = line.split('\0') |
648 if len(items) == 1: | 649 if len(items) == 1: |
649 match = re.match('Binary file (.*) matches$', line) | 650 match = re.match('Binary file (.*) matches$', line) |
650 if match: | 651 if match: |
651 print 'Binary file %s matches' % os.path.join( | 652 print 'Binary file %s matches' % os.path.join( |
652 self.name, match.group(1)) | 653 self.name, match.group(1)) |
653 else: | 654 else: |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 # client dict, but more legible, and it might contain helpful comments. | 1250 # client dict, but more legible, and it might contain helpful comments. |
1250 print(client.config_content) | 1251 print(client.config_content) |
1251 return client.RunOnDeps('cleanup', args) | 1252 return client.RunOnDeps('cleanup', args) |
1252 | 1253 |
1253 | 1254 |
1254 @attr('usage', '[command] [args ...]') | 1255 @attr('usage', '[command] [args ...]') |
1255 def CMDrecurse(parser, args): | 1256 def CMDrecurse(parser, args): |
1256 """Operates on all the entries. | 1257 """Operates on all the entries. |
1257 | 1258 |
1258 Runs a shell command on all entries. | 1259 Runs a shell command on all entries. |
| 1260 Sets GCLIENT_DEP_PATH enviroment variable as the dep's relative location to |
| 1261 root directory of the checkout. |
1259 """ | 1262 """ |
1260 # Stop parsing at the first non-arg so that these go through to the command | 1263 # Stop parsing at the first non-arg so that these go through to the command |
1261 parser.disable_interspersed_args() | 1264 parser.disable_interspersed_args() |
1262 parser.add_option('-s', '--scm', action='append', default=[], | 1265 parser.add_option('-s', '--scm', action='append', default=[], |
1263 help='Choose scm types to operate upon.') | 1266 help='Choose scm types to operate upon.') |
1264 parser.add_option('-i', '--ignore', action='store_true', | 1267 parser.add_option('-i', '--ignore', action='store_true', |
1265 help='Ignore non-zero return codes from subcommands.') | 1268 help='Ignore non-zero return codes from subcommands.') |
1266 parser.add_option('--prepend-dir', action='store_true', | 1269 parser.add_option('--prepend-dir', action='store_true', |
1267 help='Prepend relative dir for use with git <cmd> --null.') | 1270 help='Prepend relative dir for use with git <cmd> --null.') |
1268 parser.add_option('--no-progress', action='store_true', | 1271 parser.add_option('--no-progress', action='store_true', |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1742 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1740 print >> sys.stderr, 'Error: %s' % str(e) | 1743 print >> sys.stderr, 'Error: %s' % str(e) |
1741 return 1 | 1744 return 1 |
1742 | 1745 |
1743 | 1746 |
1744 if '__main__' == __name__: | 1747 if '__main__' == __name__: |
1745 fix_encoding.fix_encoding() | 1748 fix_encoding.fix_encoding() |
1746 sys.exit(Main(sys.argv[1:])) | 1749 sys.exit(Main(sys.argv[1:])) |
1747 | 1750 |
1748 # vim: ts=2:sw=2:tw=80:et: | 1751 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |