How to compare tools output in HTML WebDiff - pouryafard75/DiffBenchmark GitHub Wiki

We offer 3 different ways to do the comparison:

With all information fetched directly from GitHub

To use the following API, please provide a valid OAuth token in the github-oauth.properties file. You can generate an OAuth token in GitHub Settings -> Developer settings -> Personal access tokens.

Execute CompareWithGitHubAPI.java

String url;
url = "https://github.com/Alluxio/alluxio/commit/9aeefcd8120bb3b89cdb437d8c32d2ed84b8a825";
BenchmarkWebDiff benchmarkWebDiff = BenchmarkWebDiffFactory.withURL(url);
benchmarkWebDiff.run();

With two directories containing Java source code

Execute CompareWithTwoDirectories.java

String folder1 = "/tmp/v1/";
String folder2 = "/tmp/v2/";
BenchmarkWebDiff benchmarkWebDiff = null;
try {
    benchmarkWebDiff = BenchmarkWebDiffFactory.withTwoDirectories(folder1,folder2);
} catch (Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
}
benchmarkWebDiff.run();

With a locally cloned git repository

Execute CompareWithLocallyClonedRepository.java

String url = "https://github.com/JetBrains/intellij-community/commit/7ed3f273ab0caf0337c22f0b721d51829bb0c877";
String repo = URLHelper.getRepo(url);
String commit = URLHelper.getCommit(url);
BenchmarkWebDiff benchmarkWebDiff = null;
GitService gitService = new GitServiceImpl();
String projectName = repo.substring(repo.lastIndexOf("/") + 1, repo.length() - 4);
String pathToClonedRepository = "tmp/" + projectName;

try {
  Repository repository = gitService.cloneIfNotExists(pathToClonedRepository, repo);
  benchmarkWebDiff = BenchmarkWebDiffFactory.withLocallyClonedRepo(repository, commit);

} catch (Exception e) {
  e.printStackTrace();
  throw new RuntimeException(e);
}
benchmarkWebDiff.run();