33import org .variantsync .diffdetective .AnalysisRunner ;
44import org .variantsync .diffdetective .analysis .Analysis ;
55import org .variantsync .diffdetective .analysis .FilterAnalysis ;
6- import org .variantsync .diffdetective .analysis .PreprocessingAnalysis ;
76import org .variantsync .diffdetective .analysis .StatisticsAnalysis ;
87import org .variantsync .diffdetective .datasets .PatchDiffParseOptions ;
98import org .variantsync .diffdetective .datasets .Repository ;
109import org .variantsync .diffdetective .variation .diff .filter .DiffTreeFilter ;
1110import org .variantsync .diffdetective .variation .diff .parse .DiffTreeParseOptions ;
12- import org .variantsync .diffdetective .variation .diff . transform . CutNonEditedSubtrees ;
11+ import org .variantsync .diffdetective .variation .tree . view . query . ArtifactQuery ;
1312
1413import java .io .IOException ;
1514import java .nio .file .Path ;
1615import java .nio .file .Paths ;
16+ import java .util .ArrayList ;
1717import java .util .List ;
1818
1919public class Main {
20+ /*
21+ * There is a bug in DiffView::naive when ignoreEmptyLines is set to true under
22+ * some very rare circumstances that I do not know so far. The bug occurred for
23+ * repo: emacs
24+ * commit: 2254b6c09cff8f3a83684fd159289d0e305b0e7d
25+ * patch: "src/alloc.c"
26+ * view_naive
27+ * with the following query.
28+ * What is weird that the parsing only failed when running the analyses but not when extracting the diff to a unit
29+ * test and parsing it there.
30+ * Maybe it has something to do with linebreak or whitespace characters?
31+ */
32+ private static final ArtifactQuery bugQuery = new ArtifactQuery (" /* Check both of the above conditions, for symbols. */" );
33+ public static DiffTreeParseOptions DIFFTREE_PARSE_OPTIONS =
34+ new DiffTreeParseOptions (
35+ true ,
36+ false
37+ );
38+
2039 public static Analysis AnalysisFactory (Repository repo , Path repoOutputDir ) {
2140 return new Analysis (
2241 "Views Analysis" ,
23- List .of (
24- new PreprocessingAnalysis (new CutNonEditedSubtrees (true )),
42+ new ArrayList <>( List .of (
43+ // new PreprocessingAnalysis(new CutNonEditedSubtrees(true)),
2544 new FilterAnalysis ( // filters unwanted trees
2645 DiffTreeFilter .notEmpty ()
2746 ),
2847 new ViewAnalysis (),
2948 new StatisticsAnalysis ()
30- ),
49+ )) ,
3150 repo ,
3251 repoOutputDir
3352 );
@@ -36,23 +55,22 @@ public static Analysis AnalysisFactory(Repository repo, Path repoOutputDir) {
3655 public static void main (String [] args ) throws IOException {
3756 final AnalysisRunner .Options defaultOptions = AnalysisRunner .Options .DEFAULT (args );
3857 final AnalysisRunner .Options analysisOptions = new AnalysisRunner .Options (
39- defaultOptions . repositoriesDirectory ( ),
58+ Paths . get ( ".." , "DiffDetectiveReplicationDatasets" ),
4059 Paths .get ("results" , "views" , "current" ),
4160 defaultOptions .datasetsFile (),
4261 repo -> new PatchDiffParseOptions (
4362 PatchDiffParseOptions .DiffStoragePolicy .DO_NOT_REMEMBER ,
44- new DiffTreeParseOptions (
45- true ,
46- false
47- )
63+ DIFFTREE_PARSE_OPTIONS
4864 ),
4965 defaultOptions .getFilterForRepo (),
5066 true ,
5167 false
5268 );
5369
54- AnalysisRunner .run (analysisOptions , (repository , path ) ->
55- Analysis .forEachCommit (() -> AnalysisFactory (repository , path ))
56- );
70+ AnalysisRunner .run (analysisOptions , (repository , path ) -> {
71+ //1b424533675341a2090b79a6ffc420ac6b179ce7
72+ // Analysis.forSinglePatch("2254b6c09cff8f3a83684fd159289d0e305b0e7d", "src/alloc.c", AnalysisFactory(repository, path));
73+ Analysis .forEachCommit (() -> AnalysisFactory (repository , path ));
74+ });
5775 }
5876}
0 commit comments