Search in sources :

Example 1 with ReplacePatchSetSender

use of com.google.gerrit.server.mail.send.ReplacePatchSetSender in project gerrit by GerritCodeReview.

the class PatchSetInserter method postUpdate.

@Override
public void postUpdate(Context ctx) throws OrmException {
    if (notify != NotifyHandling.NONE || !accountsToNotify.isEmpty()) {
        try {
            ReplacePatchSetSender cm = replacePatchSetFactory.create(ctx.getProject(), change.getId());
            cm.setFrom(ctx.getAccountId());
            cm.setPatchSet(patchSet, patchSetInfo);
            cm.setChangeMessage(changeMessage.getMessage(), ctx.getWhen());
            cm.addReviewers(oldReviewers.byState(REVIEWER));
            cm.addExtraCC(oldReviewers.byState(CC));
            cm.setNotify(notify);
            cm.setAccountsToNotify(accountsToNotify);
            cm.send();
        } catch (Exception err) {
            log.error("Cannot send email for new patch set on change " + change.getId(), err);
        }
    }
    if (fireRevisionCreated) {
        revisionCreated.fire(change, patchSet, ctx.getAccount(), ctx.getWhen(), notify);
    }
}
Also used : ReplacePatchSetSender(com.google.gerrit.server.mail.send.ReplacePatchSetSender) PermissionBackendException(com.google.gerrit.server.permissions.PermissionBackendException) OrmException(com.google.gwtorm.server.OrmException) AuthException(com.google.gerrit.extensions.restapi.AuthException) CommitValidationException(com.google.gerrit.server.git.validators.CommitValidationException) IOException(java.io.IOException) ResourceConflictException(com.google.gerrit.extensions.restapi.ResourceConflictException)

Aggregations

AuthException (com.google.gerrit.extensions.restapi.AuthException)1 ResourceConflictException (com.google.gerrit.extensions.restapi.ResourceConflictException)1 CommitValidationException (com.google.gerrit.server.git.validators.CommitValidationException)1 ReplacePatchSetSender (com.google.gerrit.server.mail.send.ReplacePatchSetSender)1 PermissionBackendException (com.google.gerrit.server.permissions.PermissionBackendException)1 OrmException (com.google.gwtorm.server.OrmException)1 IOException (java.io.IOException)1