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 # Files | 7 # Files |
8 # .gclient : Current client configuration, written by 'config' command. | 8 # .gclient : Current client configuration, written by 'config' command. |
9 # Format is a Python script defining 'solutions', a list whose | 9 # Format is a Python script defining 'solutions', a list whose |
10 # entries each are maps binding the strings "name" and "url" | 10 # entries each are maps binding the strings "name" and "url" |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 continue | 876 continue |
877 prefix = os.path.commonprefix( | 877 prefix = os.path.commonprefix( |
878 [self.root.root_dir.lower(), file_list[i].lower()]) | 878 [self.root.root_dir.lower(), file_list[i].lower()]) |
879 file_list[i] = file_list[i][len(prefix):] | 879 file_list[i] = file_list[i][len(prefix):] |
880 # Strip any leading path separators. | 880 # Strip any leading path separators. |
881 while file_list[i].startswith(('\\', '/')): | 881 while file_list[i].startswith(('\\', '/')): |
882 file_list[i] = file_list[i][1:] | 882 file_list[i] = file_list[i][1:] |
883 | 883 |
884 # Always parse the DEPS file. | 884 # Always parse the DEPS file. |
885 self.ParseDepsFile() | 885 self.ParseDepsFile() |
| 886 |
| 887 # Setup the merge driver for The Great Blink Reformatting. This does just |
| 888 # setup a custom merge-driver in the git config of the Chromium main project |
| 889 # but does not have any effect until somebody changes the .gitattributes |
| 890 # to refer to it. See crbug.com/574611 for more. |
| 891 # TODO(primiano): remove some weeks after the reformatting. ETA: Oct 2016. |
| 892 if parsed_url == CHROMIUM_SRC_URL: |
| 893 CFG_PREFIX = 'merge.clang_format_merge_driver' |
| 894 try: |
| 895 merge_driver = self._used_scm._Capture( |
| 896 ['config', CFG_PREFIX + '.driver']).strip() |
| 897 except subprocess2.CalledProcessError: |
| 898 merge_driver = None |
| 899 |
| 900 if not merge_driver: |
| 901 print('Installing clang-format merge driver for crbug/574611') |
| 902 self._used_scm._Capture(['config', CFG_PREFIX + '.name', |
| 903 'clang-format merge driver (crbug/574611)']) |
| 904 self._used_scm._Capture(['config', CFG_PREFIX + '.driver', |
| 905 'clang_format_merge_driver %O %A %B %L %P']) |
| 906 self._used_scm._Capture(['config', CFG_PREFIX + '.recursive', 'binary']) |
| 907 |
886 self._run_is_done(file_list or [], parsed_url) | 908 self._run_is_done(file_list or [], parsed_url) |
887 if command in ('update', 'revert') and not options.noprehooks: | 909 if command in ('update', 'revert') and not options.noprehooks: |
888 self.RunPreDepsHooks() | 910 self.RunPreDepsHooks() |
889 | 911 |
890 if self.recursion_limit: | 912 if self.recursion_limit: |
891 # Parse the dependencies of this dependency. | 913 # Parse the dependencies of this dependency. |
892 for s in self.dependencies: | 914 for s in self.dependencies: |
893 work_queue.enqueue(s) | 915 work_queue.enqueue(s) |
894 | 916 |
895 if command == 'recurse': | 917 if command == 'recurse': |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 | 2396 |
2375 | 2397 |
2376 if '__main__' == __name__: | 2398 if '__main__' == __name__: |
2377 try: | 2399 try: |
2378 sys.exit(main(sys.argv[1:])) | 2400 sys.exit(main(sys.argv[1:])) |
2379 except KeyboardInterrupt: | 2401 except KeyboardInterrupt: |
2380 sys.stderr.write('interrupted\n') | 2402 sys.stderr.write('interrupted\n') |
2381 sys.exit(1) | 2403 sys.exit(1) |
2382 | 2404 |
2383 # vim: ts=2:sw=2:tw=80:et: | 2405 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |