Search in sources :

Example 11 with RemoteFile

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;
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) DataInputStream(java.io.DataInputStream) Date(java.util.Date) IOException(java.io.IOException) Number(org.tigris.subversion.svnclientadapter.SVNRevision.Number) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) Number(org.tigris.subversion.svnclientadapter.SVNRevision.Number) ByteArrayInputStream(java.io.ByteArrayInputStream) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 12 with RemoteFile

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();
    }
}
Also used : AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ShowRevisionsDialog(org.tigris.subversion.subclipse.ui.dialogs.ShowRevisionsDialog) GetLogsCommand(org.tigris.subversion.subclipse.core.commands.GetLogsCommand) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 13 with RemoteFile

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;
}
Also used : RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ArrayList(java.util.ArrayList) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) File(java.io.File) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 14 with RemoteFile

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;
}
Also used : RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ArrayList(java.util.ArrayList) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 15 with RemoteFile

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;
}
Also used : ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ISVNLogMessage(org.tigris.subversion.svnclientadapter.ISVNLogMessage) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Aggregations

RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)18 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)10 RemoteFolder (org.tigris.subversion.subclipse.core.resources.RemoteFolder)9 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)9 ISVNRemoteFile (org.tigris.subversion.subclipse.core.ISVNRemoteFile)8 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)7 SVNException (org.tigris.subversion.subclipse.core.SVNException)7 InvocationTargetException (java.lang.reflect.InvocationTargetException)6 TeamException (org.eclipse.team.core.TeamException)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 IContainer (org.eclipse.core.resources.IContainer)3 IFile (org.eclipse.core.resources.IFile)3 IResource (org.eclipse.core.resources.IResource)3 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)3 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)3 LogEntryChangePath (org.tigris.subversion.subclipse.core.history.LogEntryChangePath)3 ISVNInfo (org.tigris.subversion.svnclientadapter.ISVNInfo)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 CoreException (org.eclipse.core.runtime.CoreException)2