Search in sources :

Example 1 with ISVNStatus

use of org.tigris.subversion.svnclientadapter.ISVNStatus in project subclipse by subclipse.

the class StatusCacheManager method updateCache.

/**
 * update the cache using the given statuses
 *
 * @param statuses
 * @param rule the scheduling rule to use when running this operation
 */
protected List<IResource> updateCache(IResource parent, final ISVNStatus[] statuses) throws CoreException {
    final List<IResource> result = new ArrayList<IResource>();
    if (statuses != null) {
        for (ISVNStatus status : statuses) {
            IResource resource = SVNWorkspaceRoot.getResourceFor(parent, status);
            result.add(updateCache(resource, status));
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) ISVNStatus(org.tigris.subversion.svnclientadapter.ISVNStatus) IResource(org.eclipse.core.resources.IResource)

Example 2 with ISVNStatus

use of org.tigris.subversion.svnclientadapter.ISVNStatus in project subclipse by subclipse.

the class StatusUpdateStrategy method collectUnversionedFolders.

/**
 * Collect the content of unversioned folders.
 *
 * @param statuses
 * @param recursive
 * @return
 */
protected ISVNStatus[] collectUnversionedFolders(ISVNStatus[] statuses, boolean recursive) {
    if (statuses == null) {
        return null;
    }
    List<ISVNStatus> processed = new ArrayList<ISVNStatus>();
    for (ISVNStatus status : statuses) {
        processed.add(status);
        if (status.getNodeKind() != SVNNodeKind.FILE && status.getTextStatus() == SVNStatusKind.UNVERSIONED) {
            File folder = status.getFile();
            if (!folder.isDirectory() && !folder.exists())
                continue;
            Set<String> alreadyProcessed = new HashSet<String>();
            processUnversionedFolder(folder, processed, recursive, alreadyProcessed);
        }
    }
    return processed.toArray(new ISVNStatus[processed.size()]);
}
Also used : ArrayList(java.util.ArrayList) ISVNStatus(org.tigris.subversion.svnclientadapter.ISVNStatus) File(java.io.File) HashSet(java.util.HashSet)

Example 3 with ISVNStatus

use of org.tigris.subversion.svnclientadapter.ISVNStatus in project subclipse by subclipse.

the class PeekStatusCommand method execute.

public void execute() throws SVNException {
    ISVNClientAdapter client = null;
    ISVNNotifyListener revisionListener = new ISVNNotifyListener() {

        public void setCommand(int command) {
        }

        public void logCommandLine(String commandLine) {
        }

        public void logMessage(String message) {
        }

        public void logError(String message) {
        }

        public void logRevision(long aRevision, String path) {
            PeekStatusCommand.this.revision = new SVNRevision.Number(aRevision);
        }

        public void logCompleted(String message) {
        }

        public void onNotify(File path, SVNNodeKind kind) {
        }
    };
    try {
        client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
        client.addNotifyListener(revisionListener);
        File file;
        if (resource != null)
            file = resource.getLocation().toFile();
        else
            file = path.toFile();
        status = null;
        ISVNStatus[] statuses = client.getStatus(file, false, true, false);
        for (int i = 0; i < statuses.length; i++) {
            if (file.equals(statuses[i].getFile())) {
                status = statuses[i];
                if (status.getUrl() == null && !(status.getTextStatus() == SVNStatusKind.UNVERSIONED))
                    info = client.getInfo(status.getFile());
                break;
            }
        }
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        if (client != null) {
            client.removeNotifyListener(revisionListener);
            SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
        }
    }
}
Also used : SVNNodeKind(org.tigris.subversion.svnclientadapter.SVNNodeKind) ISVNNotifyListener(org.tigris.subversion.svnclientadapter.ISVNNotifyListener) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNStatus(org.tigris.subversion.svnclientadapter.ISVNStatus) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) File(java.io.File) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 4 with ISVNStatus

use of org.tigris.subversion.svnclientadapter.ISVNStatus in project subclipse by subclipse.

the class StatusAndInfoCommand method collectRemoteStatuses.

private RemoteResourceStatus[] collectRemoteStatuses(ISVNStatus[] statuses, ISVNClientAdapter client, final IProgressMonitor monitor) {
    monitor.beginTask("", statuses.length);
    try {
        RemoteResourceStatus[] result = new RemoteResourceStatus[statuses.length];
        Arrays.sort(statuses, new Comparator() {

            public int compare(Object o1, Object o2) {
                return ((ISVNStatus) o1).getPath().compareTo(((ISVNStatus) o2).getPath());
            }
        });
        for (int i = 0; i < statuses.length; i++) {
            ISVNStatus status = statuses[i];
            SVNStatusKind localTextStatus = status.getTextStatus();
            if (SVNStatusKind.UNVERSIONED.equals(localTextStatus) || SVNStatusKind.ADDED.equals(localTextStatus) || SVNStatusKind.IGNORED.equals(localTextStatus)) {
                if (SVNStatusKind.NONE.equals(status.getRepositoryTextStatus()))
                    result[i] = RemoteResourceStatus.NONE;
                else
                    result[i] = new RemoteResourceStatus(statuses[i], getRevisionFor(statuses[i]));
            } else {
                result[i] = new RemoteResourceStatus(statuses[i], getRevisionFor(statuses[i]));
            }
            monitor.worked(1);
        }
        return result;
    } finally {
        monitor.done();
    }
}
Also used : RemoteResourceStatus(org.tigris.subversion.subclipse.core.resources.RemoteResourceStatus) ISVNStatus(org.tigris.subversion.svnclientadapter.ISVNStatus) SVNStatusKind(org.tigris.subversion.svnclientadapter.SVNStatusKind) Comparator(java.util.Comparator)

Example 5 with ISVNStatus

use of org.tigris.subversion.svnclientadapter.ISVNStatus in project subclipse by subclipse.

the class ResolveTreeConflictWizard method getAdds.

public ISVNStatus[] getAdds() throws SVNException {
    List adds = new ArrayList();
    statuses = getStatuses(false);
    for (int i = 0; i < statuses.length; i++) {
        if (statuses[i].getTextStatus().equals(SVNStatusKind.ADDED))
            adds.add(statuses[i]);
    }
    ISVNStatus[] addArray = new ISVNStatus[adds.size()];
    adds.toArray(addArray);
    return addArray;
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ISVNStatus(org.tigris.subversion.svnclientadapter.ISVNStatus)

Aggregations

ISVNStatus (org.tigris.subversion.svnclientadapter.ISVNStatus)14 ArrayList (java.util.ArrayList)8 IResource (org.eclipse.core.resources.IResource)8 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)7 List (java.util.List)6 IContainer (org.eclipse.core.resources.IContainer)5 GetStatusCommand (org.tigris.subversion.subclipse.core.commands.GetStatusCommand)4 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)4 File (java.io.File)3 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)3 Iterator (java.util.Iterator)2 IFile (org.eclipse.core.resources.IFile)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Comparator (java.util.Comparator)1 HashSet (java.util.HashSet)1 IProject (org.eclipse.core.resources.IProject)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Path (org.eclipse.core.runtime.Path)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1