* @param cause the cause.
* @param r the build the cause is in.
*/
public synchronized void updateTriggerContext(GerritCause cause, AbstractBuild r) {
MemoryImprint imprint = getMemoryImprint(cause.getEvent());
TriggerContext context = cause.getContext();
context.setThisBuild(r);
for (MemoryImprint.Entry entry : imprint.getEntries()) {
if (entry.getBuild() != null && !entry.getBuild().equals(r)) {
context.addOtherBuild(entry.getBuild());
updateTriggerContext(entry, imprint);
} else if (entry.getBuild() == null && !entry.getProject().equals(r.getProject())) {
context.addOtherProject(entry.getProject());
}
}
if (!r.hasntStartedYet() && !r.isBuilding()) {
try {
r.save();