/** * 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; } }
private static String getRevision(Entry entry) { String commitId = entry.getCommitId(); if (commitId != null) { return commitId; } // fall back to old SVN-specific solution, if we have only installed an old subversion-plugin // which doesn't implement getCommitId, yet try { Class<?> clazz = entry.getClass(); Method method = clazz.getMethod("getRevision", (Class[]) null); if (method == null) { return null; } Object revObj = method.invoke(entry, (Object[]) null); return (revObj != null) ? revObj.toString() : null; } catch (Exception e) { return null; } }
for (Object o : changes) { ChangeLogSet.Entry entry = (ChangeLogSet.Entry) o; String commitID = (entry.getParent().getKind().equalsIgnoreCase("svn")) ? entry.getCommitId() : entry.getCommitId().substring(0, 6);
assertNotNull(b3Entry); assertEquals(failingEntry.getCommitId(), b3Entry.getCommitId());
public static List<Change> getChanges(AbstractBuild<?, ?> build) { RepositoryBrowser repositoryBrowser = build.getProject().getScm().getBrowser(); List<Change> result = new ArrayList<>(); for (ChangeLogSet.Entry entry : build.getChangeSet()) { UserInfo user = UserInfo.getUser(entry.getAuthor()); String changeLink = null; if (repositoryBrowser != null) { try { @SuppressWarnings("unchecked") URL link = repositoryBrowser.getChangeSetLink(entry); if (link != null) { changeLink = link.toExternalForm(); } } catch (IOException e) { LOG.log(Level.WARNING, "Could not get changeset link for: " + build.getProject().getFullDisplayName() + " " + build.getDisplayName(), e); } } result.add(new Change(user, entry.getMsgAnnotated(), entry.getCommitId(), changeLink)); } return result; }
/** * 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; } }
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; } }