try {
// I get the tags of the project. They are also known in other Version Control Systems as Releases.
tags = (ArrayList<String>) fDotGit.getTags();
fMonitor.beginTask("Importing revision history", tags.size() + 1);
} catch (JavaGitException e) {
throw new GitImporterException("Problems encountered while fetching all the git tags", e);
} catch (IOException e) {
throw new GitImporterException("Problems encountered while fetching all the git tags", e);
}
// For each tag/release I extract its history
for (String tag : tags) {
GitLogOptions options = new GitLogOptions();
options.setOptSpecificTag(true, tag);
options.setOptFileDetails(true);
options.setOptOrderingReverse(true);
options.setOptLimitNoMerges(true); // Don't care about merges for now
options.setOptFileChangeType(true);
try {
fMonitor.subTask("Extracting history for tag " + tag);
handleRelease(options, tag);
fMonitor.worked(1);
} catch (JavaGitException e) {
throw new GitImporterException("Problems encountered while importing git history for release " + tag, e);
} catch (IOException e) {
throw new GitImporterException("Problems encountered while importing git history for release " + tag, e);
}
}
if (!tags.isEmpty()) {
fMonitor.subTask("Saving the data");
fMapper.saveModel();
} else {
throw new GitImporterException("The GIT repository contains no tags therefore no history could be extracted");
}
fMonitor.worked(1);
fMonitor.done();
LOGGER.debug("Repository " + fGitRepositoryLocation + " imported successfully");
}