Skip to content
pouryafard75 edited this page Aug 30, 2022 · 3 revisions

Welcome to the RM-ASTDiff wiki!

Diff

You can run this tool as below:

Run the diff commit-level:

ProjectASTDiff projectASTDiff = ProjectASTDiffer.fromURL(url).diff();

Run the diff locally-cloned-repo level:

ProjectASTDiff projectASTDiff = ProjectASTDiffer.fromLocalRepo(localDir,commitID).diff();

Run the diff directory-level:

ProjectASTDiff projectASTDiff = ProjectASTDiffer.fromLocalDirectories(dir1 , dir2) .diff()

Run the diff file-level:

ProjectASTDiff projectASTDiff = ProjectASTDiffer.fromLocalFiles("file1.java" , "file2.java").diff();

ProjectASTDiff is the object type that we use to store the result of the diff execution.

Mappings

If you are using this tool on the file-level, you can access the mappings with the following command:

MultiMappingStore mappings = projectASTDiff.getAstDiffMap().values().iterator().next().getMappings();

In general, ASTDiff list is accessible via projectASTDiff.getAstDiffMap() which is a Map from DiffInfo to ASTDiff. DiffInfo stores additional information such as file names for the parent and child versions to enhance the visualization.

Visualization

You can execute the GUI (webdiff) on the projectASTDiff:

WebDiff webDiff = new WebDiff(projectASTDiff);

webDiff.run();