String getChanges(AbstractBuild r) { if (!r.hasChangeSetComputed()) { logger.info("No change set computed..."); return null; } ChangeLogSet changeSet = r.getChangeSet(); List<Entry> entries = new LinkedList<Entry>(); Set<AffectedFile> files = new HashSet<AffectedFile>(); for (Object o : changeSet.getItems()) { Entry entry = (Entry) o; logger.info("Entry " + o); entries.add(entry); files.addAll(entry.getAffectedFiles()); } if (entries.isEmpty()) { logger.info("Empty change..."); return null; } Set<String> authors = new HashSet<String>(); for (Entry entry : entries) { authors.add(entry.getAuthor().getDisplayName()); } MessageBuilder message = new MessageBuilder(notifier, r); message.append("Started by changes from "); message.append(StringUtils.join(authors, ", ")); message.append(" ("); message.append(files.size()); message.append(" file(s) changed)"); return message.appendOpenLink().toString(); }
public void started(AbstractBuild build) { String changes = getChanges(build); CauseAction cause = build.getAction(CauseAction.class); if (changes != null) { notifyStart(build, changes); } else if (cause != null) { MessageBuilder message = new MessageBuilder(notifier, build); message.append(cause.getShortDescription()); notifyStart(build, message.appendOpenLink().toString()); } else { notifyStart(build, getBuildStatusMessage(build)); } }
String getBuildStatusMessage(AbstractBuild r) { MessageBuilder message = new MessageBuilder(notifier, r); message.appendStatusMessage(); message.appendDuration(); return message.appendOpenLink().toString(); }