OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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 # Wrapper script around Rietveld's upload.py that groups files into | 6 # Wrapper script around Rietveld's upload.py that groups files into |
7 # changelists. | 7 # changelists. |
8 | 8 |
9 import getpass | 9 import getpass |
10 import os | 10 import os |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 Basic commands: | 600 Basic commands: |
601 ----------------------------------------- | 601 ----------------------------------------- |
602 gcl change change_name | 602 gcl change change_name |
603 Add/remove files to a changelist. Only scans the current directory and | 603 Add/remove files to a changelist. Only scans the current directory and |
604 subdirectories. | 604 subdirectories. |
605 | 605 |
606 gcl upload change_name [-r reviewer1@gmail.com,reviewer2@gmail.com,...] | 606 gcl upload change_name [-r reviewer1@gmail.com,reviewer2@gmail.com,...] |
607 [--send_mail] [--no_try] [--no_presubmit] | 607 [--send_mail] [--no_try] [--no_presubmit] |
608 Uploads the changelist to the server for review. | 608 Uploads the changelist to the server for review. |
609 | 609 |
610 gcl commit change_name [--force] | 610 gcl commit change_name [--no_presubmit] [--force] |
611 Commits the changelist to the repository. | 611 Commits the changelist to the repository. |
612 | 612 |
613 gcl lint change_name | 613 gcl lint change_name |
614 Check all the files in the changelist for possible style violations. | 614 Check all the files in the changelist for possible style violations. |
615 | 615 |
616 Advanced commands: | 616 Advanced commands: |
617 ----------------------------------------- | 617 ----------------------------------------- |
618 gcl delete change_name | 618 gcl delete change_name |
619 Deletes a changelist. | 619 Deletes a changelist. |
620 | 620 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 cpplint.ProcessFile(file, cpplint._cpplint_state.verbose_level) | 1016 cpplint.ProcessFile(file, cpplint._cpplint_state.verbose_level) |
1017 | 1017 |
1018 print "Total errors found: %d\n" % cpplint._cpplint_state.error_count | 1018 print "Total errors found: %d\n" % cpplint._cpplint_state.error_count |
1019 os.chdir(previous_cwd) | 1019 os.chdir(previous_cwd) |
1020 | 1020 |
1021 | 1021 |
1022 def DoPresubmitChecks(change_info, committing): | 1022 def DoPresubmitChecks(change_info, committing): |
1023 """Imports presubmit, then calls presubmit.DoPresubmitChecks.""" | 1023 """Imports presubmit, then calls presubmit.DoPresubmitChecks.""" |
1024 # Need to import here to avoid circular dependency. | 1024 # Need to import here to avoid circular dependency. |
1025 import presubmit_support | 1025 import presubmit_support |
| 1026 root_presubmit = GetCachedFile('PRESUBMIT.py', use_root=True) |
1026 result = presubmit_support.DoPresubmitChecks(change_info, | 1027 result = presubmit_support.DoPresubmitChecks(change_info, |
1027 committing, | 1028 committing, |
1028 verbose=False, | 1029 verbose=False, |
1029 output_stream=sys.stdout, | 1030 output_stream=sys.stdout, |
1030 input_stream=sys.stdin) | 1031 input_stream=sys.stdin, |
| 1032 default_presubmit=root_presubmit) |
1031 if not result: | 1033 if not result: |
1032 print "\nPresubmit errors, can't continue (use --no_presubmit to bypass)" | 1034 print "\nPresubmit errors, can't continue (use --no_presubmit to bypass)" |
1033 return result | 1035 return result |
1034 | 1036 |
1035 | 1037 |
1036 def Changes(): | 1038 def Changes(): |
1037 """Print all the changelists and their files.""" | 1039 """Print all the changelists and their files.""" |
1038 for cl in GetCLs(): | 1040 for cl in GetCLs(): |
1039 change_info = LoadChangelistInfo(cl, True, True) | 1041 change_info = LoadChangelistInfo(cl, True, True) |
1040 print "\n--- Changelist " + change_info.name + ":" | 1042 print "\n--- Changelist " + change_info.name + ":" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 # the files. This allows commands such as 'gcl diff xxx' to work. | 1140 # the files. This allows commands such as 'gcl diff xxx' to work. |
1139 args =["svn", command] | 1141 args =["svn", command] |
1140 root = GetRepositoryRoot() | 1142 root = GetRepositoryRoot() |
1141 args.extend([os.path.join(root, x) for x in change_info.FileList()]) | 1143 args.extend([os.path.join(root, x) for x in change_info.FileList()]) |
1142 RunShell(args, True) | 1144 RunShell(args, True) |
1143 return 0 | 1145 return 0 |
1144 | 1146 |
1145 | 1147 |
1146 if __name__ == "__main__": | 1148 if __name__ == "__main__": |
1147 sys.exit(main()) | 1149 sys.exit(main()) |
OLD | NEW |