use of org.tigris.subversion.subclipse.core.resources.BaseResource in project subclipse by subclipse.
the class GetLogsCommand method run.
/**
* execute the command
*
* @param aMonitor
* @throws SVNException
*/
public void run(IProgressMonitor aMonitor) throws SVNException {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
logEntries = null;
IProgressMonitor monitor = Policy.monitorFor(aMonitor);
// $NON-NLS-1$
monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100);
ISVNLogMessage[] logMessages;
try {
if (callback == null) {
logMessages = remoteResource.getLogMessages(pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions);
} else {
repository = remoteResource.getRepository();
svnClient = repository.getSVNClient();
if (remoteResource instanceof BaseResource) {
boolean logMessagesRetrieved = false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(remoteResource.getResource());
if (svnResource != null) {
LocalResourceStatus status = svnResource.getStatus();
if (status != null && status.isCopied()) {
ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile());
SVNUrl copiedFromUrl = info.getCopyUrl();
if (copiedFromUrl != null) {
svnClient.getLogMessages(copiedFromUrl, SVNRevision.HEAD, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
logMessagesRetrieved = true;
GetRemoteResourceCommand getRemoteResourceCommand = new GetRemoteResourceCommand(remoteResource.getRepository(), copiedFromUrl, SVNRevision.HEAD);
getRemoteResourceCommand.run(null);
remoteResource = getRemoteResourceCommand.getRemoteResource();
}
}
}
if (!logMessagesRetrieved)
svnClient.getLogMessages(((BaseResource) remoteResource).getFile(), pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
} else {
svnClient.getLogMessages(remoteResource.getUrl(), pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
}
logMessages = callback.getLogMessages();
}
if (remoteResource.isFolder()) {
logEntries = LogEntry.createLogEntriesFrom((ISVNRemoteFolder) remoteResource, logMessages, getTags(logMessages));
} else {
logEntries = LogEntry.createLogEntriesFrom((ISVNRemoteFile) remoteResource, logMessages, getTags(logMessages), getUrls(logMessages));
}
} catch (Exception e) {
throw SVNException.wrapException(e);
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
monitor.done();
}
}
Aggregations