| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 hashlib | 5 import hashlib |
| 6 import json | 6 import json |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 from recipe_engine import recipe_api | 9 from recipe_engine import recipe_api |
| 10 | 10 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 # We have uploaded before, now let's check the diff hash to see if we | 229 # We have uploaded before, now let's check the diff hash to see if we |
| 230 # have uploaded this patchset before. | 230 # have uploaded this patchset before. |
| 231 change_data = json.loads(cat_result.stdout) | 231 change_data = json.loads(cat_result.stdout) |
| 232 cat_result.presentation.links['Issue %s' % change_data['issue']] = ( | 232 cat_result.presentation.links['Issue %s' % change_data['issue']] = ( |
| 233 change_data['issue_url']) | 233 change_data['issue_url']) |
| 234 # Pass --rietveld flag to match upload args below. | 234 # Pass --rietveld flag to match upload args below. |
| 235 self.m.git('cl', 'issue', change_data['issue'], '--rietveld', cwd=workdir) | 235 self.m.git('cl', 'issue', change_data['issue'], '--rietveld', cwd=workdir) |
| 236 if change_data['diff_digest'] != diff_digest: | 236 if change_data['diff_digest'] != diff_digest: |
| 237 need_to_upload = True | 237 need_to_upload = True |
| 238 rebase = True | 238 rebase = True |
| 239 elif roll_result['trivial']: | |
| 240 # We won't be uploading. Make sure trivial rolls don't get stuck | |
| 241 # if previous CQ attempt failed because of flake. | |
| 242 # Pass --rietveld flag to match upload args below. | |
| 243 self.m.git('cl', 'set-commit', '--rietveld', cwd=workdir) | |
| 244 | 239 |
| 245 if need_to_upload: | 240 if need_to_upload: |
| 246 commit_message = ( | 241 commit_message = ( |
| 247 'Rebase' if rebase else get_commit_message(roll_result)) | 242 'Rebase' if rebase else get_commit_message(roll_result)) |
| 248 if roll_result['trivial']: | 243 if roll_result['trivial']: |
| 249 # Land immediately. | 244 # Land immediately. |
| 250 upload_args = ['--use-commit-queue'] | 245 upload_args = ['--use-commit-queue'] |
| 251 if not rebase: | 246 if not rebase: |
| 252 commit_message += '\nTBR=%s\n' % ','.join(TRIVIAL_ROLL_TBR_EMAILS) | 247 commit_message += '\nTBR=%s\n' % ','.join(TRIVIAL_ROLL_TBR_EMAILS) |
| 253 else: | 248 else: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 277 'issue': m.group(1), | 272 'issue': m.group(1), |
| 278 'issue_url': m.group(2), | 273 'issue_url': m.group(2), |
| 279 'diff_digest': diff_digest, | 274 'diff_digest': diff_digest, |
| 280 } | 275 } |
| 281 issue_result.presentation.links['Issue %s' % change_data['issue']] = ( | 276 issue_result.presentation.links['Issue %s' % change_data['issue']] = ( |
| 282 change_data['issue_url']) | 277 change_data['issue_url']) |
| 283 self.m.gsutil.upload( | 278 self.m.gsutil.upload( |
| 284 self.m.json.input(change_data), | 279 self.m.json.input(change_data), |
| 285 'recipe-roller-cl-uploads', | 280 'recipe-roller-cl-uploads', |
| 286 cfg_digest) | 281 cfg_digest) |
| OLD | NEW |