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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 import copy | 75 import copy |
76 import logging | 76 import logging |
77 import optparse | 77 import optparse |
78 import os | 78 import os |
79 import platform | 79 import platform |
80 import posixpath | 80 import posixpath |
81 import pprint | 81 import pprint |
82 import re | 82 import re |
83 import sys | 83 import sys |
| 84 import time |
84 import urllib | 85 import urllib |
85 import urlparse | 86 import urlparse |
86 | 87 |
87 import breakpad # pylint: disable=W0611 | 88 import breakpad # pylint: disable=W0611 |
88 | 89 |
89 import fix_encoding | 90 import fix_encoding |
90 import gclient_scm | 91 import gclient_scm |
91 import gclient_utils | 92 import gclient_utils |
92 from third_party.repo.progress import Progress | 93 from third_party.repo.progress import Progress |
93 import subprocess2 | 94 import subprocess2 |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 result.append(self.GetHookAction(hook_dict, matching_file_list)) | 774 result.append(self.GetHookAction(hook_dict, matching_file_list)) |
774 for s in self.dependencies: | 775 for s in self.dependencies: |
775 result.extend(s.GetHooks(options)) | 776 result.extend(s.GetHooks(options)) |
776 return result | 777 return result |
777 | 778 |
778 def RunHooksRecursively(self, options): | 779 def RunHooksRecursively(self, options): |
779 assert self.hooks_ran == False | 780 assert self.hooks_ran == False |
780 self._hooks_ran = True | 781 self._hooks_ran = True |
781 for hook in self.GetHooks(options): | 782 for hook in self.GetHooks(options): |
782 try: | 783 try: |
| 784 start_time = time.time() |
783 gclient_utils.CheckCallAndFilterAndHeader( | 785 gclient_utils.CheckCallAndFilterAndHeader( |
784 hook, cwd=self.root.root_dir, always=True) | 786 hook, cwd=self.root.root_dir, always=True) |
785 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 787 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
786 # Use a discrete exit status code of 2 to indicate that a hook action | 788 # Use a discrete exit status code of 2 to indicate that a hook action |
787 # failed. Users of this script may wish to treat hook action failures | 789 # failed. Users of this script may wish to treat hook action failures |
788 # differently from VC failures. | 790 # differently from VC failures. |
789 print >> sys.stderr, 'Error: %s' % str(e) | 791 print >> sys.stderr, 'Error: %s' % str(e) |
790 sys.exit(2) | 792 sys.exit(2) |
| 793 finally: |
| 794 elapsed_time = time.time() - start_time |
| 795 if elapsed_time > 10: |
| 796 print "Hook '%s' took %.2f secs" % ( |
| 797 gclient_utils.CommandToStr(hook), elapsed_time) |
791 | 798 |
792 def subtree(self, include_all): | 799 def subtree(self, include_all): |
793 """Breadth first recursion excluding root node.""" | 800 """Breadth first recursion excluding root node.""" |
794 dependencies = self.dependencies | 801 dependencies = self.dependencies |
795 for d in dependencies: | 802 for d in dependencies: |
796 if d.should_process or include_all: | 803 if d.should_process or include_all: |
797 yield d | 804 yield d |
798 for d in dependencies: | 805 for d in dependencies: |
799 for i in d.subtree(include_all): | 806 for i in d.subtree(include_all): |
800 yield i | 807 yield i |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1849 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1843 print >> sys.stderr, 'Error: %s' % str(e) | 1850 print >> sys.stderr, 'Error: %s' % str(e) |
1844 return 1 | 1851 return 1 |
1845 | 1852 |
1846 | 1853 |
1847 if '__main__' == __name__: | 1854 if '__main__' == __name__: |
1848 fix_encoding.fix_encoding() | 1855 fix_encoding.fix_encoding() |
1849 sys.exit(Main(sys.argv[1:])) | 1856 sys.exit(Main(sys.argv[1:])) |
1850 | 1857 |
1851 # vim: ts=2:sw=2:tw=80:et: | 1858 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |