-
Notifications
You must be signed in to change notification settings - Fork 1
How to check RefactoringMiner's diff output
pouryafard75 edited this page Oct 7, 2023
·
1 revision
Check RefactoringMiner's output in the Webdiff view:
There are 3 different ways you can execute DiffBenchmark:
Execute RunWithLocallyClonedRepository.java
String url = "https://github.com/JetBrains/intellij-community/commit/7ed3f273ab0caf0337c22f0b721d51829bb0c877";
String repo = URLHelper.getRepo(url);
String commit = URLHelper.getCommit(url);
GitService gitService = new GitServiceImpl();
String projectName = repo.substring(repo.lastIndexOf("/") + 1, repo.length() - 4);
String pathToClonedRepository = "tmp/" + projectName;
Repository repository = gitService.cloneIfNotExists(pathToClonedRepository, repo);
ProjectASTDiff projectASTDiff = new GitHistoryRefactoringMinerImpl().diffAtCommit(repository, commit);
new WebDiff(projectASTDiff).run();
Execute RunWithTwoDirectories.java
final String projectRoot = System.getProperty("user.dir");
String folder1 = projectRoot + "/tmp/v1/";
String folder2 = projectRoot + "/tmp/v2/";
ProjectASTDiff projectASTDiff = new GitHistoryRefactoringMinerImpl().diffAtDirectories(Path.of(folder1), Path.of(folder2));
new WebDiff(projectASTDiff).run();
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 RunWithGitHubAPI.java
String url = "https://github.com/JetBrains/intellij-community/commit/7ed3f273ab0caf0337c22f0b721d51829bb0c877";
String repo = URLHelper.getRepo(url);
String commit = URLHelper.getCommit(url);
ProjectASTDiff projectASTDiff = new GitHistoryRefactoringMinerImpl().diffAtCommit(repo, commit, 1000);
new WebDiff(projectASTDiff).run();