@Override protected PollingResult compareRemoteRevisionWith( AbstractProject<?, ?> project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException { if (isFirstBuild(baseline)) { return PollingResult.BUILD_NOW; } AbstractClearCaseSCMRevisionState ccBaseline = (AbstractClearCaseSCMRevisionState) baseline; AbstractBuild<?, ?> build = project.getSomeBuildWithWorkspace(); if (build == null) { return PollingResult.BUILD_NOW; } VariableResolver<String> variableResolver = new BuildVariableResolver(build); HistoryAction historyAction = createHistoryAction( variableResolver, createClearToolLauncher(listener, workspace, launcher), build); Change change; String viewPath = getViewPath(variableResolver); String viewName = getViewName(variableResolver); String[] branchNames = getBranchNames(variableResolver); if (historyAction.hasChanges( ccBaseline.getBuildTime(), viewPath, viewName, branchNames, ccBaseline.getLoadRules())) { change = Change.SIGNIFICANT; } else { change = Change.NONE; } return new PollingResult(baseline, calcRevisionsFromPoll(build, launcher, listener), change); }
private boolean saveChangeLog( AbstractBuild build, Launcher launcher, BuildListener listener, File changelogFile, ClearToolLauncher clearToolLauncher, VariableResolver<String> variableResolver, SaveChangeLogAction saveChangeLogAction, String coNormalizedViewName, boolean returnValue) throws IOException, InterruptedException { List<? extends ChangeLogSet.Entry> changelogEntries; @SuppressWarnings("unchecked") Run prevBuild = build.getPreviousBuild(); Date lastBuildTime = getBuildTime(prevBuild); HistoryAction historyAction = createHistoryAction(variableResolver, clearToolLauncher, build); changelogEntries = historyAction.getChanges( lastBuildTime, getViewPath(variableResolver), coNormalizedViewName, getBranchNames(variableResolver), getViewPaths(variableResolver, build, launcher)); // Save change log if (CollectionUtils.isEmpty(changelogEntries)) { // no changes returnValue = createEmptyChangeLog(changelogFile, listener, "changelog"); } else { saveChangeLogAction.saveChangeLog(changelogFile, changelogEntries); } return returnValue; }