OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import re | 6 import re |
7 import sys | 7 import sys |
8 | 8 |
9 | 9 |
10 def LoadSupport(input_api): | 10 def LoadSupport(input_api): |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 results.append(output_api.PresubmitError( | 74 results.append(output_api.PresubmitError( |
75 'Hash file exists, but file not found: %s' % hash_path)) | 75 'Hash file exists, but file not found: %s' % hash_path)) |
76 continue | 76 continue |
77 if cloud_storage.GetHash(file_path) != file_hash: | 77 if cloud_storage.GetHash(file_path) != file_hash: |
78 results.append(output_api.PresubmitError( | 78 results.append(output_api.PresubmitError( |
79 'Hash file does not match file\'s actual hash: %s' % hash_path)) | 79 'Hash file does not match file\'s actual hash: %s' % hash_path)) |
80 continue | 80 continue |
81 | 81 |
82 try: | 82 try: |
83 bucket_input = raw_input('Uploading to Cloud Storage: %s\n' | 83 bucket_input = raw_input('Uploading to Cloud Storage: %s\n' |
84 'Is this file [p]ublic or Google-[i]nternal?' | 84 'Is this file [P]ublic or Google-[i]nternal?' |
85 % file_path).lower() | 85 % file_path).lower() |
86 if 'public'.startswith(bucket_input): | 86 if 'public'.startswith(bucket_input): |
87 bucket = cloud_storage.PUBLIC_BUCKET | 87 bucket = cloud_storage.PUBLIC_BUCKET |
88 elif ('internal'.startswith(bucket_input) or | 88 elif ('internal'.startswith(bucket_input) or |
89 'google-internal'.startswith(bucket_input)): | 89 'google-internal'.startswith(bucket_input)): |
90 bucket = cloud_storage.INTERNAL_BUCKET | 90 bucket = cloud_storage.INTERNAL_BUCKET |
91 else: | 91 else: |
92 results.append(output_api.PresubmitError( | 92 results.append(output_api.PresubmitError( |
93 'Response was neither "public" nor "internal": %s' % bucket_input)) | 93 'Response was neither "public" nor "internal": %s' % bucket_input)) |
94 return results | 94 return results |
(...skipping 20 matching lines...) Expand all Loading... |
115 'data file is not in Cloud Storage: %s' % hash_path)) | 115 'data file is not in Cloud Storage: %s' % hash_path)) |
116 return results | 116 return results |
117 | 117 |
118 | 118 |
119 def CheckChangeOnUpload(input_api, output_api): | 119 def CheckChangeOnUpload(input_api, output_api): |
120 return _SyncFilesToCloud(input_api, output_api) | 120 return _SyncFilesToCloud(input_api, output_api) |
121 | 121 |
122 | 122 |
123 def CheckChangeOnCommit(input_api, output_api): | 123 def CheckChangeOnCommit(input_api, output_api): |
124 return _VerifyFilesInCloud(input_api, output_api) | 124 return _VerifyFilesInCloud(input_api, output_api) |
OLD | NEW |