final ICVSFolder folder = cvsResource.getParent();
final FolderSyncInfo info = folder.getFolderSyncInfo();
final ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(
info.getRoot());
final Session session = new Session(location, folder, true /* output to console */);
session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
try {
final Command.QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
try {
CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
final Command.LocalOption[] localOption;
if (revision == null) {
localOption = Command.NO_LOCAL_OPTIONS;
}
else {
localOption = new Command.LocalOption[1];
localOption[0] = Annotate.makeRevisionOption(revision);
}
final IStatus status = Command.ANNOTATE.execute(session, Command.NO_GLOBAL_OPTIONS,
localOption, new ICVSResource[]{cvsResource
}, listener, Policy.subMonitorFor(monitor, 90));
if (status.getCode() == CVSStatus.SERVER_ERROR) {
throw new CVSServerException(status);
}
}
finally {
CVSProviderPlugin.getPlugin().setQuietness(quietness);
monitor.done();
}
}
finally {
session.close();
}
}