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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 for i in range(len(file_list)): | 567 for i in range(len(file_list)): |
568 # It depends on the command being executed (like runhooks vs sync). | 568 # It depends on the command being executed (like runhooks vs sync). |
569 if not os.path.isabs(file_list[i]): | 569 if not os.path.isabs(file_list[i]): |
570 continue | 570 continue |
571 prefix = os.path.commonprefix( | 571 prefix = os.path.commonprefix( |
572 [self.root.root_dir.lower(), file_list[i].lower()]) | 572 [self.root.root_dir.lower(), file_list[i].lower()]) |
573 file_list[i] = file_list[i][len(prefix):] | 573 file_list[i] = file_list[i][len(prefix):] |
574 # Strip any leading path separators. | 574 # Strip any leading path separators. |
575 while file_list[i].startswith(('\\', '/')): | 575 while file_list[i].startswith(('\\', '/')): |
576 file_list[i] = file_list[i][1:] | 576 file_list[i] = file_list[i][1:] |
577 elif command is 'recurse': | 577 elif command == 'recurse': |
578 if not isinstance(parsed_url, self.FileImpl): | 578 if not isinstance(parsed_url, self.FileImpl): |
579 # Skip file only checkout. | 579 # Skip file only checkout. |
580 scm = gclient_scm.GetScmName(parsed_url) | 580 scm = gclient_scm.GetScmName(parsed_url) |
581 if not options.scm or scm in options.scm: | 581 if not options.scm or scm in options.scm: |
582 cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name)) | 582 cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name)) |
583 # Pass in the SCM type as an env variable | 583 # Pass in the SCM type as an env variable |
584 env = os.environ.copy() | 584 env = os.environ.copy() |
585 if scm: | 585 if scm: |
586 env['GCLIENT_SCM'] = scm | 586 env['GCLIENT_SCM'] = scm |
587 if parsed_url: | 587 if parsed_url: |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 revision_overrides = {} | 1011 revision_overrides = {} |
1012 # It's unnecessary to check for revision overrides for 'recurse'. | 1012 # It's unnecessary to check for revision overrides for 'recurse'. |
1013 # Save a few seconds by not calling _EnforceRevisions() in that case. | 1013 # Save a few seconds by not calling _EnforceRevisions() in that case. |
1014 if command not in ('diff', 'recurse', 'runhooks', 'status'): | 1014 if command not in ('diff', 'recurse', 'runhooks', 'status'): |
1015 revision_overrides = self._EnforceRevisions() | 1015 revision_overrides = self._EnforceRevisions() |
1016 pm = None | 1016 pm = None |
1017 # Disable progress for non-tty stdout. | 1017 # Disable progress for non-tty stdout. |
1018 if (sys.stdout.isatty() and not self._options.verbose): | 1018 if (sys.stdout.isatty() and not self._options.verbose): |
1019 if command in ('update', 'revert'): | 1019 if command in ('update', 'revert'): |
1020 pm = Progress('Syncing projects', 1) | 1020 pm = Progress('Syncing projects', 1) |
1021 elif command is 'recurse': | 1021 elif command == 'recurse': |
1022 pm = Progress(' '.join(args), 1) | 1022 pm = Progress(' '.join(args), 1) |
1023 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, pm) | 1023 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, pm) |
1024 for s in self.dependencies: | 1024 for s in self.dependencies: |
1025 work_queue.enqueue(s) | 1025 work_queue.enqueue(s) |
1026 work_queue.flush(revision_overrides, command, args, options=self._options) | 1026 work_queue.flush(revision_overrides, command, args, options=self._options) |
1027 | 1027 |
1028 # Once all the dependencies have been processed, it's now safe to run the | 1028 # Once all the dependencies have been processed, it's now safe to run the |
1029 # hooks. | 1029 # hooks. |
1030 if not self._options.nohooks: | 1030 if not self._options.nohooks: |
1031 self.RunHooksRecursively(self._options) | 1031 self.RunHooksRecursively(self._options) |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1623 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1624 print >> sys.stderr, 'Error: %s' % str(e) | 1624 print >> sys.stderr, 'Error: %s' % str(e) |
1625 return 1 | 1625 return 1 |
1626 | 1626 |
1627 | 1627 |
1628 if '__main__' == __name__: | 1628 if '__main__' == __name__: |
1629 fix_encoding.fix_encoding() | 1629 fix_encoding.fix_encoding() |
1630 sys.exit(Main(sys.argv[1:])) | 1630 sys.exit(Main(sys.argv[1:])) |
1631 | 1631 |
1632 # vim: ts=2:sw=2:tw=80:et: | 1632 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |