/** * Method used for actually calculating the culprits from scratch. Called by {@link #getCulprits()} and * overrides of {@link #getCulprits()}. Does not persist culprits information. * * @return a non-null {@link Set} of {@link User}s associated with this item. */ @SuppressWarnings("unchecked") @Nonnull default Set<User> calculateCulprits() { Set<User> r = new HashSet<>(); RunT p = ((RunT)this).getPreviousCompletedBuild(); if (p != null) { Result pr = p.getResult(); if (pr != null && pr.isWorseThan(Result.SUCCESS)) { // we are still building, so this is just the current latest information, // but we seems to be failing so far, so inherit culprits from the previous build. r.addAll(p.getCulprits()); } } for (ChangeLogSet<? extends ChangeLogSet.Entry> c : getChangeSets()) { for (ChangeLogSet.Entry e : c) { r.add(e.getAuthor()); } } return r; }
/** * Returns true if this user has made a commit to this build. */ @SuppressWarnings("unchecked") default boolean hasParticipant(User user) { for (ChangeLogSet<? extends ChangeLogSet.Entry> c : getChangeSets()) { for (ChangeLogSet.Entry e : c) { try { if (e.getAuthor() == user) { return true; } } catch (RuntimeException re) { Logger LOGGER = Logger.getLogger(RunWithSCM.class.getName()); LOGGER.log(Level.INFO, "Failed to determine author of changelog " + e.getCommitId() + "for " + ((RunT) this).getParent().getDisplayName() + ", " + ((RunT) this).getDisplayName(), re); } } } return false; } }
for (Entry e : cs) { stdout.printf("%s,%s%n", QuotedStringTokenizer.quote(e.getAuthor().getId()), QuotedStringTokenizer.quote(e.getMsg())); for (ChangeLogSet<?> cs : ((RunWithSCM<?, ?>) build).getChangeSets()) { for (Entry e : cs) { stdout.printf("%s\t%s%n", e.getAuthor(), e.getMsg()); for (String p : e.getAffectedPaths()) { stdout.println(" " + p);
public String getEntryTitle(FeedItem item) { return "#" + item.getBuild().number + ' ' + item.e.getMsg() + " (" + item.e.getAuthor() + ")"; }
/** * Returns true if this user has made a commit to this build. * * @since 1.191 */ public boolean hasParticipant(User user) { for (ChangeLogSet.Entry e : getChangeSet()) { if (e.getAuthor() == user) { return true; } } return false; }
private static Set<User> getCommitters(AbstractBuild<?, ?> build) { Set<User> committers = new HashSet<User>(); ChangeLogSet<? extends Entry> changeSet = build.getChangeSet(); for (Entry entry : changeSet) { committers.add(entry.getAuthor()); } return committers; }
public String getEntryTitle(FeedItem item) { return "#"+item.getBuild().number+' '+item.e.getMsg()+" ("+item.e.getAuthor()+")"; }
/** * Adds a user to the recipients list based on a specific SCM change set * @param change The ChangeLogSet.Entry to get the user information from * @param to The list of to addresses to add to * @param cc The list of cc addresses to add to * @param bcc The list of bcc addresses to add to * @param env The build environment * @param listener The listener for logging */ private void addUserFromChangeSet(ChangeLogSet.Entry change, Set<InternetAddress> to, Set<InternetAddress> cc, Set<InternetAddress> bcc, EnvVars env, final ExtendedEmailPublisherContext context, RecipientProviderUtilities.IDebug debug) { User user = change.getAuthor(); RecipientProviderUtilities.addUsers(Collections.singleton(user), context, env, to, cc, bcc, debug); }
/** * Returns true if this user has made a commit to this build. * * @since 1.191 */ public boolean hasParticipant(User user) { for (ChangeLogSet.Entry e : getChangeSet()) if (e.getAuthor()==user) return true; return false; }
private static Set<User> getCommitters(AbstractBuild<?, ?> build) { Set<User> committers = new HashSet<User>(); ChangeLogSet<? extends Entry> changeSet = build.getChangeSet(); for (Entry entry : changeSet) { committers.add(entry.getAuthor()); } return committers; }
public static List<Change> getChanges(List<ChangeLogSet<? extends ChangeLogSet.Entry>> changes) { List<Change> result = new ArrayList<>(); for (ChangeLogSet<? extends ChangeLogSet.Entry> entries : changes) { for (ChangeLogSet.Entry entry : entries) { UserInfo user = UserInfo.getUser(entry.getAuthor()); result.add(new Change(user, entry.getMsgAnnotated(), entry.getCommitId(), null)); } } return result; } }
/** * Returns true if this user has made a commit to this build. * * @since 1.191 */ public boolean hasParticipant(User user) { for (ChangeLogSet.Entry e : getChangeSet()) if (e.getAuthor()==user) return true; return false; }
/** * Returns true if this user has made a commit to this build. * * @since 1.191 */ public boolean hasParticipant(User user) { for (ChangeLogSet.Entry e : getChangeSet()) if (e.getAuthor()==user) return true; return false; }
private static void addChangeSetUsers(ChangeLogSet<?> changeLogSet, Set<User> users, IDebug debug) { final Set<User> changeAuthors = new HashSet<User>(); for (final ChangeLogSet.Entry change : changeLogSet) { final User changeAuthor = change.getAuthor(); if (changeAuthors.add(changeAuthor)) { debug.send(" adding author: %s", changeAuthor.getFullName()); } } users.addAll(changeAuthors); }
for (ChangeLogSet<? extends ChangeLogSet.Entry> c : runWithSCM.getChangeSets()) { for (ChangeLogSet.Entry entry : c) { User user = entry.getAuthor(); UserInfo info = users.get(user); if (info == null) {
/** * @deprecated Potentially very expensive call; do not use from Jelly views. */ @Deprecated public static boolean isApplicable(Collection<? extends Item> items) { for (Item item : items) { for (Job job : item.getAllJobs()) { RunList<? extends Run<?, ?>> runs = job.getBuilds(); for (Run<?,?> r : runs) { if (r instanceof RunWithSCM) { RunWithSCM<?,?> runWithSCM = (RunWithSCM<?,?>) r; for (ChangeLogSet<? extends Entry> c : runWithSCM.getChangeSets()) { for (Entry entry : c) { User user = entry.getAuthor(); if (user != null) return true; } } } } } } return false; } }
private Map<User,UserInfo> getUserInfo(Collection<? extends Item> items) { Map<User,UserInfo> users = new HashMap<User,UserInfo>(); for (Item item : items) { for (Job<?, ?> job : item.getAllJobs()) { RunList<? extends Run<?, ?>> runs = job.getBuilds(); for (Run<?, ?> r : runs) { if (r instanceof RunWithSCM) { RunWithSCM<?,?> runWithSCM = (RunWithSCM<?,?>) r; for (ChangeLogSet<? extends Entry> c : runWithSCM.getChangeSets()) { for (Entry entry : c) { User user = entry.getAuthor(); UserInfo info = users.get(user); if (info == null) users.put(user, new UserInfo(user, job, r.getTimestamp())); else if (info.getLastChange().before(r.getTimestamp())) { info.project = job; info.lastChange = r.getTimestamp(); } } } } } } } return users; }
@Override @Nonnull public Set<User> calculateCulprits() { Set<User> c = RunWithSCM.super.calculateCulprits(); AbstractBuild<P,R> p = getPreviousCompletedBuild(); if (upstreamCulprits) { // If we have dependencies since the last successful build, add their authors to our list if (p != null && p.getPreviousNotFailedBuild() != null) { Map<AbstractProject, AbstractBuild.DependencyChange> depmap = p.getDependencyChanges(p.getPreviousSuccessfulBuild()); for (AbstractBuild.DependencyChange dep : depmap.values()) { for (AbstractBuild<?, ?> b : dep.getBuilds()) { for (ChangeLogSet.Entry entry : b.getChangeSet()) { c.add(entry.getAuthor()); } } } } } return c; }
public String getEntryTitle(FeedItem item) { return "#" + item.getBuild().number + ' ' + item.e.getMsg() + " (" + item.e.getAuthor() + ")"; }