Skip to content

Commit 608741e

Browse files
committed
simplify methods for processing commit batches
1 parent 3f9da98 commit 608741e

1 file changed

Lines changed: 9 additions & 21 deletions

File tree

  • src/main/java/org/variantsync/diffdetective/analysis

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

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ public static AnalysisResult forSingleCommit(final String commitHash, final Anal
317317
AnalysisResult result = null;
318318
try {
319319
final RevCommit commit = analysis.differ.getCommit(commitHash);
320-
result = analysis.processCommits(List.of(commit), analysis.differ);
320+
analysis.processCommitBatch(List.of(commit));
321+
result = analysis.getResult();
321322
} catch (Exception e) {
322323
Logger.error("Failed to analyze {}. Exiting.", commitHash);
323324
System.exit(1);
@@ -413,7 +414,12 @@ public static AnalysisResult forEachCommit(
413414
),
414415
/// 2.) Create a MiningTask for the list of commits. This task will then be processed by one
415416
/// particular thread.
416-
commitList -> () -> analysisFactory.get().processCommits(commitList, analysis.differ)
417+
commitList -> () -> {
418+
Analysis thisThreadsAnalysis = analysisFactory.get();
419+
thisThreadsAnalysis.differ = analysis.differ;
420+
thisThreadsAnalysis.processCommitBatch(commitList);
421+
return thisThreadsAnalysis.getResult();
422+
}
417423
);
418424
Logger.info("<<< done in {}", clock.printPassedSeconds());
419425

@@ -474,29 +480,11 @@ public Analysis(
474480
}
475481

476482
/**
477-
* Entry point into a sequential analysis of {@code commits} as one batch.
478-
* Same as {@link #processCommits(List, GitDiffer)} with a default {@link GitDiffer}.
479-
*
480-
* @param commits the commit batch to be processed
481-
* @see #forEachCommit
482-
*/
483-
public AnalysisResult processCommits(List<RevCommit> commits) throws Exception {
484-
return processCommits(commits, new GitDiffer(getRepository()));
485-
}
486-
487-
/**
488-
* Entry point into a sequential analysis of {@code commits} as one batch.
483+
* Sequential analysis of all {@code commits} as one batch.
489484
*
490485
* @param commits the commit batch to be processed
491-
* @param differ the differ to use
492486
* @see #forEachCommit
493487
*/
494-
public AnalysisResult processCommits(List<RevCommit> commits, GitDiffer differ) throws Exception {
495-
this.differ = differ;
496-
processCommitBatch(commits);
497-
return getResult();
498-
}
499-
500488
protected void processCommitBatch(List<RevCommit> commits) throws Exception {
501489
outputFile = outputDir.resolve(commits.get(0).getId().getName());
502490

0 commit comments

Comments
 (0)