use of org.tigris.subversion.svnclientadapter.ISVNLogMessageCallback in project subclipse by subclipse.
the class Cache method refresh.
public void refresh(List refreshedNodes, ISVNInfo info, IProgressMonitor monitor, int unitWorked) {
ISVNLogMessageCallback callback = new ISVNLogMessageCallback() {
public void singleMessage(ISVNLogMessage message) {
update(message, true);
}
};
revisionsTempFile = new File(root, "revisionsTemp");
logMessagesTempFile = new File(root, "logMessagesTemp");
revisionsTempFile.delete();
logMessagesTempFile.delete();
try {
revisionsTempFile.createNewFile();
logMessagesTempFile.createNewFile();
} catch (IOException e) {
Activator.handleError(e);
}
List revisions = new ArrayList();
Iterator iter = refreshedNodes.iterator();
while (iter.hasNext()) {
Node node = (Node) iter.next();
revisions.add(Long.toString(node.getRevision()));
}
startTempUpdate();
RandomAccessFile file = null;
ISVNClientAdapter client = null;
try {
client = SVNProviderPlugin.getPlugin().getSVNClient();
file = new RandomAccessFile(logMessagesFile, "r");
int revInt = new Long(getLatestRevision()).intValue();
while (file.getFilePointer() < file.length()) {
ISVNLogMessage lm = readNext(file, true);
level = 0;
int index = revisions.indexOf(lm.getRevision().toString());
if (index == -1) {
update(lm, true);
if (lm.hasChildren() && lm.getChildMessages() != null) {
updateChildren(lm, true);
}
monitor.worked(unitWorked / revInt);
} else {
Node updateNode = (Node) refreshedNodes.get(index);
SVNRevision updateRevision = new SVNRevision.Number(updateNode.getRevision());
client.getLogMessages(new SVNUrl(info.getRepository() + updateNode.getPath()), updateRevision, updateRevision, updateRevision, false, true, 0, true, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
monitor.worked(unitWorked);
// updateRevision = (ISVNLogMessage)refreshedMessages.get(index);
// monitor.worked(unitWorked);
}
if (monitor.isCanceled()) {
break;
}
}
} catch (Exception e) {
} finally {
closeFile(file);
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
finishTempUpdate();
if (monitor.isCanceled()) {
revisionsTempFile.delete();
logMessagesTempFile.delete();
return;
}
revisionsFile.delete();
logMessagesFile.delete();
revisionsTempFile.renameTo(revisionsFile);
logMessagesTempFile.renameTo(logMessagesFile);
}
Aggregations