Skip to content

Commit 9ce5bc5

Browse files
committed
Revert "initial implementation for excluding diffs with only comment changes"
This reverts commit f237cff.
1 parent acaf30f commit 9ce5bc5

File tree

3 files changed

+6
-31
lines changed

3 files changed

+6
-31
lines changed

src/main/java/gui/webdiff/dir/DirectoryDiffView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ else if(isMovedCode(nodeInfo)) {
206206
}
207207
}
208208
}
209-
ASTDiff astDiff = comparator.getASTDiff(nodeInfo.getId());
210-
boolean empty = astDiff.isEmpty();
211-
if(!empty && astDiff.changesOtherThanCommentUpdates()) {
209+
boolean empty = comparator.getASTDiff(nodeInfo.getId()).isEmpty();
210+
if(!empty) {
211+
ASTDiff astDiff = comparator.getASTDiff(nodeInfo.getId());
212212
String datatype;
213213
String datapath;
214214
if (astDiff.getSrcPath().equals(astDiff.getDstPath())) {

src/main/java/gui/webdiff/viewers/spv/AbstractSinglePageView.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import gui.webdiff.viewers.monaco.MonacoCore;
55
import gui.webdiff.dir.DirComparator;
66
import gui.webdiff.dir.DirectoryDiffView;
7-
8-
import org.refactoringminer.astDiff.models.ASTDiff;
97
import org.refactoringminer.astDiff.models.DiffMetaInfo;
108
import org.rendersnake.DocType;
119
import org.rendersnake.HtmlCanvas;
@@ -44,10 +42,9 @@ public void renderOn(HtmlCanvas html) {
4442
// Generate panels for /monaco-0 to /monaco-n
4543
for (int i = 0; i < n; i++) {
4644
Pair<String, String> fileContentsPair = comparator.getFileContentsPair(i);
47-
ASTDiff astDiff = comparator.getASTDiff(i);
48-
boolean empty = astDiff.isEmpty();
49-
if(!empty && astDiff.changesOtherThanCommentUpdates()) {
50-
MonacoCore core = new MonacoCore(comparator, astDiff, i, comparator.isMoveDiff(i), fileContentsPair.first, fileContentsPair.second, comparator.getRefactorings(), metaInfo.getComments());
45+
boolean empty = comparator.getASTDiff(i).isEmpty();
46+
if(!empty) {
47+
MonacoCore core = new MonacoCore(comparator, comparator.getASTDiff(i), i, comparator.isMoveDiff(i), fileContentsPair.first, fileContentsPair.second, comparator.getRefactorings(), metaInfo.getComments());
5148
core.setShowFilenames(false);
5249
html.div(class_("card"))
5350
.div(class_("card-header").id("heading-" + i).style("padding-right: 0;"))

src/main/java/org/refactoringminer/astDiff/models/ASTDiff.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import com.github.gumtreediff.actions.*;
44
import com.github.gumtreediff.actions.model.Action;
5-
import com.github.gumtreediff.actions.model.Update;
65
import com.github.gumtreediff.matchers.MappingStore;
76
import com.github.gumtreediff.tree.Tree;
87
import com.github.gumtreediff.tree.TreeContext;
98
import org.refactoringminer.astDiff.actions.classifier.ExtendedOnlyRootsClassifier;
109
import org.refactoringminer.astDiff.actions.editscript.ExtendedEditScriptGenerator;
11-
import org.refactoringminer.astDiff.actions.model.MultiMove;
1210

1311
import java.util.Map;
1412
import java.util.Objects;
@@ -125,24 +123,4 @@ public boolean equals(Object obj) {
125123
ASTDiff other = (ASTDiff) obj;
126124
return Objects.equals(dstPath, other.dstPath) && Objects.equals(srcPath, other.srcPath);
127125
}
128-
129-
public boolean changesOtherThanCommentUpdates() {
130-
for(com.github.gumtreediff.actions.model.Action action : this.editScript.asList()) {
131-
boolean validMultiMove = false;
132-
if(action instanceof MultiMove) {
133-
validMultiMove = action.getNode().getType().name.equals("TextElement") ||
134-
action.getNode().getType().name.equals("LineComment");
135-
}
136-
boolean validUpdate = false;
137-
if(action instanceof Update) {
138-
validUpdate = action.getNode().getType().name.equals("TextElement") ||
139-
action.getNode().getType().name.equals("LineComment") ||
140-
action.getNode().getType().name.equals("BlockComment");
141-
}
142-
if(!validUpdate && !validMultiMove) {
143-
return true;
144-
}
145-
}
146-
return false;
147-
}
148126
}

0 commit comments

Comments
 (0)