use of org.opensolaris.opengrok.configuration.Configuration.RemoteSCM 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);
History history = null;
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)) {
history = historyCache.get(file, repo, withFiles);
} else {
history = repo.getHistory(file);
}
}
return history;
}