@Override
protected IStatus run(IProgressMonitor monitor) {
try {
EvolizerSessionHandler handler = EvolizerSessionHandler.getHandler();
handler.updateSchema(this.project);
IEvolizerSession persistenceProvider = handler.getCurrentSession(this.project);
String[] repositoryData = new String[3];
repositoryData[0] = "";
repositoryData[1] = "";
String url =
((SVNTeamProvider) RepositoryProvider.getProvider(this.project)).getRepositoryResource().getUrl();
if (url.contains("/trunk")) {
repositoryData[2] = url.substring(0, url.indexOf("/trunk"));
} else if (url.contains("/tags")) {
repositoryData[2] = url.substring(0, url.indexOf("/tags"));
} else if (url.contains("/branches")) {
repositoryData[2] = url.substring(0, url.indexOf("/branches"));
} else {
repositoryData[2] = url;
}
EvolizerSVNImporter importer = new EvolizerSVNImporter(repositoryData);
// Checking what type of file content import to run (there are 4 types of file content import)
switch (this.importType) {
// fetch file content for the whole history (all the existing revisions)
case 0:
try {
importer.fetchRevisionRangeSource(persistenceProvider, this.fileExtensionRegEx, 0, -1, monitor);
} catch (SVNImporterException e) {
sLogger.error("Import of missing file content for the whole SVN history failed:", e);
return Status.CANCEL_STATUS;
} finally {
persistenceProvider.close();
}
break;
// Fetch file content for all existing releases
case 1:
try {
importer.fetchReleasesSource(persistenceProvider, this.fileExtensionRegEx, null, monitor);
} catch (SVNImporterException e) {
sLogger.error("Import of missing file content for all the existing releases failed:", e);
return Status.CANCEL_STATUS;
} finally {
persistenceProvider.close();
}
break;
// Fetch file content for a revision range
case 2:
try {
importer.fetchRevisionRangeSource(
persistenceProvider,
this.fileExtensionRegEx,
this.start,
this.end,
monitor);
} catch (SVNImporterException e) {
sLogger.error("Import of missing file content for the " + this.start + ":" + this.end + " revision range failed:", e);
return Status.CANCEL_STATUS;
} finally {
persistenceProvider.close();
}
break;
// Fetch file content for selected releases
case 3:
try {
importer.fetchReleasesSource(
persistenceProvider,
this.fileExtensionRegEx,
this.releases,
monitor);
} catch (SVNImporterException e) {
sLogger.error("Import of missing file content for a given set of releases failed:", e);
return Status.CANCEL_STATUS;
} finally {
persistenceProvider.close();
}
break;
default:
break;
}