Skip to content

Commit b1d59d0

Browse files
committed
fix: allow merging AnalysisResults for different repositories
We need this to accumulate results of our evaluations across many repositories. I decided to issue a warning for now so that users could check whether this is indeed intended. In our current use cases, the warning is actually obsolete.
1 parent 8e0a117 commit b1d59d0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/org/variantsync/diffdetective/analysis/AnalysisResult.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.List;
1010
import java.util.Map;
1111

12+
import org.tinylog.Logger;
1213
import org.variantsync.diffdetective.diff.result.DiffError;
1314
import org.variantsync.diffdetective.metadata.Metadata;
1415
import org.variantsync.functjonal.Cast;
@@ -99,7 +100,11 @@ public <T extends Metadata<T>> void append(ResultKey<T> resultKey, T value) {
99100
* Merges the second results values into the first result.
100101
*/
101102
public static final InplaceSemigroup<AnalysisResult> ISEMIGROUP = (a, b) -> {
102-
a.repoName = Metadata.mergeEqual(a.repoName, b.repoName);
103+
a.repoName = Metadata.mergeIfEqualElse(a.repoName, b.repoName,
104+
(ar, br) -> {
105+
Logger.warn("Merging analysis for different repos {} and {}!", ar, br);
106+
return ar + "; " + br;
107+
});
103108
a.taskName = Metadata.mergeEqual(a.taskName, b.taskName);
104109
a.runtimeWithMultithreadingInSeconds += b.runtimeWithMultithreadingInSeconds;
105110
a.totalCommits += b.totalCommits;

0 commit comments

Comments
 (0)