| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 if command[0] == 'python': | 441 if command[0] == 'python': |
| 442 # If the hook specified "python" as the first item, the action is a | 442 # If the hook specified "python" as the first item, the action is a |
| 443 # Python script. Run it by starting a new copy of the same | 443 # Python script. Run it by starting a new copy of the same |
| 444 # interpreter. | 444 # interpreter. |
| 445 command[0] = sys.executable | 445 command[0] = sys.executable |
| 446 | 446 |
| 447 if '$matching_files' in command: | 447 if '$matching_files' in command: |
| 448 splice_index = command.index('$matching_files') | 448 splice_index = command.index('$matching_files') |
| 449 command[splice_index:splice_index + 1] = matching_file_list | 449 command[splice_index:splice_index + 1] = matching_file_list |
| 450 | 450 |
| 451 # Use a discrete exit status code of 2 to indicate that a hook action | 451 try: |
| 452 # failed. Users of this script may wish to treat hook action failures | 452 gclient_utils.CheckCallAndFilterAndHeader( |
| 453 # differently from VC failures. | 453 command, cwd=self.root_dir(), always=True) |
| 454 return gclient_utils.SubprocessCall(command, cwd=self.root_dir(), | 454 except gclient_utils.Error, e: |
| 455 fail_status=2) | 455 # Use a discrete exit status code of 2 to indicate that a hook action |
| 456 # failed. Users of this script may wish to treat hook action failures |
| 457 # differently from VC failures. |
| 458 print >> sys.stderr, 'Error: %s' % str(e) |
| 459 sys.exit(2) |
| 456 | 460 |
| 457 def root_dir(self): | 461 def root_dir(self): |
| 458 return self.parent.root_dir() | 462 return self.parent.root_dir() |
| 459 | 463 |
| 460 def enforced_os(self): | 464 def enforced_os(self): |
| 461 return self.parent.enforced_os() | 465 return self.parent.enforced_os() |
| 462 | 466 |
| 463 def recursion_limit(self): | 467 def recursion_limit(self): |
| 464 return self.parent.recursion_limit() - 1 | 468 return self.parent.recursion_limit() - 1 |
| 465 | 469 |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 return CMDhelp(parser, argv) | 1228 return CMDhelp(parser, argv) |
| 1225 except gclient_utils.Error, e: | 1229 except gclient_utils.Error, e: |
| 1226 print >> sys.stderr, 'Error: %s' % str(e) | 1230 print >> sys.stderr, 'Error: %s' % str(e) |
| 1227 return 1 | 1231 return 1 |
| 1228 | 1232 |
| 1229 | 1233 |
| 1230 if '__main__' == __name__: | 1234 if '__main__' == __name__: |
| 1231 sys.exit(Main(sys.argv[1:])) | 1235 sys.exit(Main(sys.argv[1:])) |
| 1232 | 1236 |
| 1233 # vim: ts=2:sw=2:tw=80:et: | 1237 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |