myLogger.warning("Failed to fetch " + upperLimitRevision + ", will not analyze diff with upper limit revision");
return;
}
+
+ if (myRevision.equals(upperLimitRevision)) {
+ myLogger.message("Build revision is the same as the upper limit revision, skip checking diff");
+ return;
+ }
+
List<String> pathsMatchedByRules = getChangedFilesMatchedByRules(upperLimitRevision);
if (!pathsMatchedByRules.isEmpty()) {
StringBuilder msg = new StringBuilder();
myLogger.error(msg.toString());
String type = "UpperLimitRevisionDiff";
myLogger.logBuildProblem(BuildProblemData.createBuildProblem(type + myRoot.getId(), type, "Diff with upper limit revision found"));
+ } else {
+ myLogger.message("No diff matched by checkout rules found");
}
} finally {
myLogger.activityFinished(message, GitBuildProgressLogger.GIT_PROGRESS_ACTIVITY);
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
public class DiffCommandImpl extends BaseCommandImpl implements DiffCommand {
}
ExecResult r = CommandUtil.runCommand(cmd);
- return Arrays.asList(StringUtil.splitByLines(r.getStdout().trim()));
+ String stdout = r.getStdout().trim();
+ return StringUtil.isEmpty(stdout) ? Collections.<String>emptyList() : Arrays.asList(StringUtil.splitByLines(stdout));
}
}
}
+ public void no_error_when_revisions_are_the_same() throws Exception {
+ String version = "ad4528ed5c84092fdbe9e0502163cf8d6e6141e7";
+ AgentRunningBuild build = createBuild(version, version);
+ myVcsSupport.updateSources(myRoot, new CheckoutRules("+:.=>dir"), version, myCheckoutDir, build, false);
+ then(myBuildLogger.getErrors()).isEmpty();
+ }
+
+
private AgentRunningBuild createBuild(@NotNull String buildRevision, @Nullable String upperLimitRevision, String... additionalParams) {
String rootExtId = "RootExtId";
Map<String, String> params = new HashMap<>();