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 """Enables directory-specific presubmit checks to run at upload and/or commit. | 6 """Enables directory-specific presubmit checks to run at upload and/or commit. |
7 """ | 7 """ |
8 | 8 |
9 __version__ = '1.8.0' | 9 __version__ = '1.8.0' |
10 | 10 |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1294 output.write('Presubmit checks passed.\n') | 1294 output.write('Presubmit checks passed.\n') |
1295 elif may_prompt: | 1295 elif may_prompt: |
1296 output.prompt_yes_no('There were presubmit warnings. ' | 1296 output.prompt_yes_no('There were presubmit warnings. ' |
1297 'Are you sure you wish to continue? (y/N): ') | 1297 'Are you sure you wish to continue? (y/N): ') |
1298 else: | 1298 else: |
1299 output.fail() | 1299 output.fail() |
1300 | 1300 |
1301 global _ASKED_FOR_FEEDBACK | 1301 global _ASKED_FOR_FEEDBACK |
1302 # Ask for feedback one time out of 5. | 1302 # Ask for feedback one time out of 5. |
1303 if (len(results) and random.randint(0, 4) == 0 and not _ASKED_FOR_FEEDBACK): | 1303 if (len(results) and random.randint(0, 4) == 0 and not _ASKED_FOR_FEEDBACK): |
1304 output.write("Was the presubmit check useful? Please send feedback " | 1304 output.write( |
1305 "& hate mail to maruel@chromium.org!\n") | 1305 'Was the presubmit check useful? If not, run "git cl presubmit -v"\n' |
1306 'to figure out the PRESUBMIT.py which were run, then run git blame\n' | |
iannucci
2014/01/14 02:38:39
to figure out which PRESUBMIT.py was run, ...
M-A Ruel
2014/01/14 15:19:50
Done.
| |
1307 'on the file to figure out who to ask for help.\n') | |
1306 _ASKED_FOR_FEEDBACK = True | 1308 _ASKED_FOR_FEEDBACK = True |
1307 return output | 1309 return output |
1308 finally: | 1310 finally: |
1309 os.environ = old_environ | 1311 os.environ = old_environ |
1310 | 1312 |
1311 | 1313 |
1312 def ScanSubDirs(mask, recursive): | 1314 def ScanSubDirs(mask, recursive): |
1313 if not recursive: | 1315 if not recursive: |
1314 return [x for x in glob.glob(mask) if '.svn' not in x and '.git' not in x] | 1316 return [x for x in glob.glob(mask) if '.svn' not in x and '.git' not in x] |
1315 else: | 1317 else: |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1506 except PresubmitFailure, e: | 1508 except PresubmitFailure, e: |
1507 print >> sys.stderr, e | 1509 print >> sys.stderr, e |
1508 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1510 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
1509 print >> sys.stderr, 'If all fails, contact maruel@' | 1511 print >> sys.stderr, 'If all fails, contact maruel@' |
1510 return 2 | 1512 return 2 |
1511 | 1513 |
1512 | 1514 |
1513 if __name__ == '__main__': | 1515 if __name__ == '__main__': |
1514 fix_encoding.fix_encoding() | 1516 fix_encoding.fix_encoding() |
1515 sys.exit(Main(None)) | 1517 sys.exit(Main(None)) |
OLD | NEW |