Skip to content

Commit febe042

Browse files
committed
✨ track and log number of identical and differing files in HTML diff
1 parent edf4bc7 commit febe042

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/main/java/com/pdiff/DiffCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ public void doit() throws IOException {
5959

6060
System.out.println("Diff command executed " + all.size());
6161
System.out.println("Reference result: " + run1);
62-
System.out.println("Compared result: " + run2);
6362

6463
// for (Cmp cmp : all.values())
6564
// if (cmp.bothPresent() && cmp.isSame() == false)
6665
// System.out.println(cmp);
6766

6867
final Path outHtml = Paths.get(run1 + "-" + run2 + ".html");
6968

70-
new HtmlDiff(outHtml, dbCollection.getMinimalPrefix(), all.values());
69+
final HtmlDiff htmlDiff = new HtmlDiff(outHtml, dbCollection.getMinimalPrefix(), all.values());
70+
System.out.println("same=" + htmlDiff.getSame() + " diff=" + htmlDiff.getDiff());
7171

7272
}
7373
}

src/main/java/com/pdiff/html/HtmlDiff.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
import com.pdiff.core.DbFileAfterRun;
1111

1212
public class HtmlDiff {
13+
14+
private int same = 0;
15+
private int diff = 0;
1316

1417
public HtmlDiff(Path outHtml, int minimalPrefix, Collection<Cmp> cmps) throws IOException {
1518

@@ -163,8 +166,11 @@ def on_input(event):
163166
for (Cmp cmp : cmps) {
164167
if (cmp.bothPresent() == false)
165168
continue;
166-
if (cmp.isSame())
169+
if (cmp.isSame()) {
170+
same++;
167171
continue;
172+
}
173+
diff++;
168174

169175
final DbFileAfterRun run1 = cmp.getRun1();
170176
final DbFileAfterRun run2 = cmp.getRun2();
@@ -225,6 +231,14 @@ def on_input(event):
225231
}
226232
}
227233

234+
public int getSame() {
235+
return same;
236+
}
237+
238+
public int getDiff() {
239+
return diff;
240+
}
241+
228242
// private void outSingleFile(PrintWriter pw, DbFileForRun file) throws IOException {
229243
// final String name = file.getFileName(minimalPrefix).replace(".puml", "");
230244
// pw.print("<div class=detail_result id=" + name + ">");

0 commit comments

Comments
 (0)