use of org.opensolaris.opengrok.util.ForbiddenSymlinkException in project OpenGrok by OpenGrok.
the class HistoryGuru method getHistory.
/**
* Get the history for the specified file.
*
* @param file the file to get the history for
* @param withFiles whether or not the returned history should contain a
* list of files touched by each changeset (the file list may be skipped if
* false, but it doesn't have to)
* @param ui called from the webapp
* @return history for the file
* @throws HistoryException on error when accessing the history
*/
public History getHistory(File file, boolean withFiles, boolean ui) throws HistoryException {
final File dir = file.isDirectory() ? file : file.getParentFile();
final Repository repo = getRepository(dir);
RemoteSCM rscm = RuntimeEnvironment.getInstance().getRemoteScmSupported();
boolean doRemote = (ui && (rscm == RemoteSCM.UIONLY)) || (rscm == RemoteSCM.ON) || (ui || ((rscm == RemoteSCM.DIRBASED) && (repo != null) && repo.hasHistoryForDirectories()));
if (repo != null && repo.isWorking() && repo.fileHasHistory(file) && (!repo.isRemote() || doRemote)) {
if (useCache() && historyCache.supportsRepository(repo)) {
try {
return historyCache.get(file, repo, withFiles);
} catch (ForbiddenSymlinkException ex) {
LOGGER.log(Level.FINER, ex.getMessage());
return null;
}
}
return repo.getHistory(file);
}
return null;
}
Aggregations