| OLD | NEW |
| 1 # Copyright 2008 Google Inc. | 1 # Copyright 2008 Google Inc. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 request.issue.reviewers.append(request.user.email()) | 386 request.issue.reviewers.append(request.user.email()) |
| 387 # Update the issue with the checking/unchecking of the CQ box but reduce | 387 # Update the issue with the checking/unchecking of the CQ box but reduce |
| 388 # spam by not emailing users. | 388 # spam by not emailing users. |
| 389 action = 'checked' if request.issue.commit else 'unchecked' | 389 action = 'checked' if request.issue.commit else 'unchecked' |
| 390 commit_checked_msg = 'The CQ bit was %s by %s' % (action, user_email) | 390 commit_checked_msg = 'The CQ bit was %s by %s' % (action, user_email) |
| 391 if request.issue.cq_dry_run: | 391 if request.issue.cq_dry_run: |
| 392 commit_checked_msg += ' to run a CQ dry run' | 392 commit_checked_msg += ' to run a CQ dry run' |
| 393 request.issue.cq_dry_run_last_triggered_by = user_email | 393 request.issue.cq_dry_run_last_triggered_by = user_email |
| 394 logging.info('CQ dry run has been triggered by %s for %d/%d', user_email, | 394 logging.info('CQ dry run has been triggered by %s for %d/%d', user_email, |
| 395 request.issue.key.id(), last_patchset.key.id()) | 395 request.issue.key.id(), last_patchset.key.id()) |
| 396 # Mail just the owner if the CQ bit was unchecked by someone other than the | 396 # Mail just the owner and only if the CQ bit was unchecked by someone other |
| 397 # owner. More details in | 397 # than the owner or CQ itself. More details in |
| 398 # https://code.google.com/p/skia/issues/detail?id=3093 | 398 # https://code.google.com/p/skia/issues/detail?id=3093 |
| 399 unchecked_by_non_owner = (user_email != request.issue.owner.email() and | 399 send_mail = (user_email != request.issue.owner.email() and |
| 400 not request.issue.commit) | 400 user_email != views.CQ_COMMIT_BOT_EMAIL and |
| 401 not request.issue.commit) |
| 401 views.make_message(request, request.issue, commit_checked_msg, | 402 views.make_message(request, request.issue, commit_checked_msg, |
| 402 send_mail=unchecked_by_non_owner, auto_generated=True, | 403 send_mail=send_mail, auto_generated=True, |
| 403 email_to=[request.issue.owner.email()]).put() | 404 email_to=[request.issue.owner.email()]).put() |
| 404 request.issue.put() | 405 request.issue.put() |
| 405 if request.issue.commit and not request.issue.cq_dry_run: | 406 if request.issue.commit and not request.issue.cq_dry_run: |
| 406 views.notify_approvers_of_new_patchsets(request, request.issue) | 407 views.notify_approvers_of_new_patchsets(request, request.issue) |
| 407 | 408 |
| 408 if 'builders' in request.POST: | 409 if 'builders' in request.POST: |
| 409 new_builders = filter(None, map(unicode.strip, | 410 new_builders = filter(None, map(unicode.strip, |
| 410 form.cleaned_data['builders'].split(','))) | 411 form.cleaned_data['builders'].split(','))) |
| 411 if request.issue.private and new_builders: | 412 if request.issue.private and new_builders: |
| 412 return HttpResponseBadRequest( | 413 return HttpResponseBadRequest( |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 next_cursor = query_iter.cursor_after() | 781 next_cursor = query_iter.cursor_after() |
| 781 else: | 782 else: |
| 782 next_cursor = cursor | 783 next_cursor = cursor |
| 783 | 784 |
| 784 logging.info('Found %d entries, returned %d' % (total, len(jobs))) | 785 logging.info('Found %d entries, returned %d' % (total, len(jobs))) |
| 785 return { | 786 return { |
| 786 'has_more': has_more, | 787 'has_more': has_more, |
| 787 'cursor': next_cursor.urlsafe() if next_cursor else '', | 788 'cursor': next_cursor.urlsafe() if next_cursor else '', |
| 788 'jobs': jobs | 789 'jobs': jobs |
| 789 } | 790 } |
| OLD | NEW |