use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class RemoteResourceTransfer method fromByteArray.
public Object fromByteArray(byte[] buffer) {
try {
ByteArrayInputStream in = new ByteArrayInputStream(buffer);
DataInputStream readIn = new DataInputStream(in);
boolean isFolder = readIn.readBoolean();
// first, we read the url of the remote resource
SVNUrl urlResource = new SVNUrl(readIn.readUTF());
// then we read the url of the repository
String location = readIn.readUTF();
// we read the revision
SVNRevision revision = SVNRevision.getRevision(readIn.readUTF());
// we read the last changed revision
SVNRevision.Number lastChangedRevision = (Number) SVNRevision.getRevision(readIn.readUTF());
Date date = new Date(readIn.readLong());
String author = null;
try {
author = readIn.readUTF();
} catch (Exception e) {
// Ignore null author
}
ISVNRepositoryLocation repositoryLocation = SVNProviderPlugin.getPlugin().getRepository(location);
if (isFolder) {
return new RemoteFolder(null, repositoryLocation, urlResource, revision, lastChangedRevision, date, author);
}
return new RemoteFile(null, repositoryLocation, urlResource, revision, lastChangedRevision, date, author);
} catch (Exception ex) {
return null;
}
}
use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class RevisionDetailsAction method run.
public void run() {
remoteResource = null;
logEntry = null;
includeTags = SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE);
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
try {
RevisionGraphEditorInput input = (RevisionGraphEditorInput) editor.getEditorInput();
ISVNInfo info = input.getInfo();
ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(info.getRepository().toString());
remoteResource = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node.getPath()), new SVNRevision.Number(node.getRevision()));
AliasManager tagManager = null;
if (includeTags)
tagManager = new AliasManager(remoteResource.getUrl());
SVNRevision pegRevision = new SVNRevision.Number(node.getRevision());
SVNRevision revisionStart = new SVNRevision.Number(node.getRevision());
SVNRevision revisionEnd = new SVNRevision.Number(node.getRevision());
GetLogsCommand logCmd = new GetLogsCommand(remoteResource, pegRevision, revisionStart, revisionEnd, false, 0, tagManager, true);
logCmd.run(null);
ILogEntry[] logEntries = logCmd.getLogEntries();
if (logEntries != null && logEntries.length > 0) {
logEntry = logEntries[0];
}
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Revision Info", e.getMessage());
}
}
});
if (logEntry != null) {
ShowRevisionsDialog dialog = new ShowRevisionsDialog(Display.getDefault().getActiveShell(), logEntry, remoteResource, includeTags, null);
dialog.setTitle("Revision Info");
dialog.setSelectFirst(true);
dialog.open();
}
}
use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class SummaryEditionNode method getRoots.
private SummaryEditionNode[] getRoots() throws Exception {
List<String> rootPaths = new ArrayList<String>();
ArrayList roots = new ArrayList();
for (int i = 0; i < diffSummary.length; i++) {
if (include(diffSummary[i])) {
File file = new File(diffSummary[i].getPath());
if (file.getParent() == null) {
if (diffSummary[i].getNodeKind() == SVNNodeKind.DIR.toInt()) {
RemoteFolder remoteFolder = null;
if (resource.getRevision() instanceof SVNRevision.Number)
remoteFolder = new RemoteFolder(null, resource.getRepository(), new SVNUrl(resource.getUrl().toString() + "/" + diffSummary[i].getPath()), resource.getRevision(), (SVNRevision.Number) resource.getRevision(), null, null);
else
remoteFolder = new RemoteFolder(resource.getRepository(), new SVNUrl(resource.getUrl().toString() + "/" + diffSummary[i].getPath()), resource.getRevision());
remoteFolder.setPegRevision(pegRevision);
SummaryEditionNode node = new SummaryEditionNode(remoteFolder, pegRevision);
node.setDiffSummary(diffSummary);
node.setRootFolder((RemoteFolder) resource);
node.setNodeType(nodeType);
roots.add(node);
} else {
RemoteFile remoteFile = null;
if (resource.getRevision() instanceof SVNRevision.Number)
remoteFile = new RemoteFile(null, resource.getRepository(), new SVNUrl(resource.getUrl().toString() + "/" + diffSummary[i].getPath()), resource.getRevision(), (SVNRevision.Number) resource.getRevision(), null, null);
else
remoteFile = new RemoteFile(resource.getRepository(), new SVNUrl(resource.getUrl().toString() + "/" + diffSummary[i].getPath()), resource.getRevision());
remoteFile.setPegRevision(pegRevision);
SummaryEditionNode node = new SummaryEditionNode(remoteFile, pegRevision);
node.setDiffSummary(diffSummary);
node.setRootFolder((RemoteFolder) resource);
node.setNodeType(nodeType);
roots.add(node);
}
} else {
while (file.getParent() != null) {
file = file.getParentFile();
}
String path = file.getPath();
if (!rootPaths.contains(path)) {
rootPaths.add(path);
RemoteFolder remoteFolder = null;
if (resource.getRevision() instanceof SVNRevision.Number)
remoteFolder = new RemoteFolder(null, resource.getRepository(), new SVNUrl(resource.getUrl().toString() + "/" + path), resource.getRevision(), (SVNRevision.Number) resource.getRevision(), null, null);
else
remoteFolder = new RemoteFolder(resource.getRepository(), new SVNUrl(resource.getUrl().toString() + "/" + path), resource.getRevision());
SummaryEditionNode node = new SummaryEditionNode(remoteFolder, pegRevision);
node.setDiffSummary(diffSummary);
node.setRootFolder((RemoteFolder) resource);
node.setNodeType(nodeType);
roots.add(node);
}
}
}
}
SummaryEditionNode[] rootArray = new SummaryEditionNode[roots.size()];
roots.toArray(rootArray);
Arrays.sort(rootArray);
return rootArray;
}
use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class SummaryEditionNode method getChildNodes.
private SummaryEditionNode[] getChildNodes() throws Exception {
ArrayList childNodes = new ArrayList();
for (int i = 0; i < diffSummary.length; i++) {
if (include(diffSummary[i])) {
if (diffSummary[i].getNodeKind() == SVNNodeKind.DIR.toInt()) {
RemoteFolder remoteFolder = null;
if (resource.getRevision() instanceof SVNRevision.Number)
remoteFolder = new RemoteFolder(null, resource.getRepository(), new SVNUrl(rootFolder.getUrl().toString() + "/" + diffSummary[i].getPath()), resource.getRevision(), (SVNRevision.Number) resource.getRevision(), null, null);
else
remoteFolder = new RemoteFolder(resource.getRepository(), new SVNUrl(rootFolder.getUrl().toString() + "/" + diffSummary[i].getPath()), resource.getRevision());
remoteFolder.setPegRevision(pegRevision);
if (isChild(remoteFolder)) {
SummaryEditionNode node = new SummaryEditionNode(remoteFolder, pegRevision);
node.setDiffSummary(diffSummary);
node.setRootFolder(rootFolder);
node.setNodeType(nodeType);
childNodes.add(node);
}
} else {
RemoteFile remoteFile = null;
if (resource.getRevision() instanceof SVNRevision.Number)
remoteFile = new RemoteFile(null, resource.getRepository(), new SVNUrl(rootFolder.getUrl().toString() + "/" + diffSummary[i].getPath()), resource.getRevision(), (SVNRevision.Number) resource.getRevision(), null, null);
else
remoteFile = new RemoteFile(resource.getRepository(), new SVNUrl(rootFolder.getUrl().toString() + "/" + diffSummary[i].getPath()), resource.getRevision());
remoteFile.setPegRevision(pegRevision);
if (isChild(remoteFile)) {
SummaryEditionNode node = new SummaryEditionNode(remoteFile, pegRevision);
node.setDiffSummary(diffSummary);
node.setRootFolder(rootFolder);
node.setNodeType(nodeType);
childNodes.add(node);
}
}
}
}
SummaryEditionNode[] childNodeArray = new SummaryEditionNode[childNodes.size()];
childNodes.toArray(childNodeArray);
Arrays.sort(childNodeArray);
return childNodeArray;
}
use of org.tigris.subversion.subclipse.core.resources.RemoteFile in project subclipse by subclipse.
the class LogEntry method createLogEntriesFrom.
/**
* create the LogEntry for the logMessages
*
* @param logMessages
* @return
*/
public static ILogEntry[] createLogEntriesFrom(ISVNRemoteFile remoteFile, ISVNLogMessage[] logMessages, Tags[] tags, SVNUrl[] urls) {
ILogEntry[] result = new ILogEntry[logMessages.length];
for (int i = 0; i < logMessages.length; i++) {
ISVNLogMessage logMessage = logMessages[i];
ISVNRemoteResource correspondingResource;
correspondingResource = new RemoteFile(null, remoteFile.getRepository(), urls[i], logMessage.getRevision(), logMessage.getRevision(), logMessage.getDate(), logMessage.getAuthor());
result[i] = new LogEntry(logMessage, remoteFile, correspondingResource, (tags[i] != null) ? tags[i].getTags() : null);
}
return result;
}
Aggregations