Search in sources :

Example 1 with SVNStatusKind

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

the class SVNStatusSyncInfo method calculateKind.

/* (non-Javadoc)
   * @see org.eclipse.team.core.synchronize.SyncInfo#calculateKind()
   */
protected int calculateKind() throws TeamException {
    SVNStatusKind localKind = baseStatusInfo.getStatusKind();
    SVNStatusKind repositoryKind = (remoteStatusInfo != null) ? remoteStatusInfo.getStatusKind() : SVNStatusKind.NORMAL;
    IResource local = getLocal();
    boolean filtered = !local.exists() && local.getLocation().toFile().exists();
    if (filtered) {
        return SyncInfo.IN_SYNC;
    }
    if (!local.exists() && !(local.getLocation() == null || local.getLocation().toFile().exists())) {
        if (isAddition(repositoryKind))
            return SyncInfo.INCOMING | SyncInfo.ADDITION;
        if (localKind == SVNStatusKind.UNVERSIONED)
            return SyncInfo.IN_SYNC;
        if (isDeletion(repositoryKind))
            return SyncInfo.IN_SYNC;
        if (!repositoryKind.equals(SVNStatusKind.ADDED)) {
            if (localKind == SVNStatusKind.NONE) {
                return SyncInfo.IN_SYNC;
            }
            if (isChange(repositoryKind))
                return SyncInfo.CONFLICTING | SyncInfo.DELETION;
            return SyncInfo.OUTGOING | SyncInfo.DELETION;
        } else
            return SyncInfo.INCOMING | SyncInfo.ADDITION;
    } else if (isDeletion(localKind)) {
        if (isNotModified(repositoryKind)) {
            if (isOutOfDate())
                return SyncInfo.CONFLICTING | SyncInfo.DELETION;
            else
                return SyncInfo.OUTGOING | SyncInfo.DELETION;
        } else
            return SyncInfo.CONFLICTING | SyncInfo.DELETION;
    } else if (isChange(localKind)) {
        if (isChange(repositoryKind) || isAddition(repositoryKind) || isDeletion(repositoryKind))
            return SyncInfo.CONFLICTING | SyncInfo.CHANGE;
        else {
            if ((IResource.FOLDER == local.getType() || IResource.PROJECT == local.getType()) && isOutOfDate())
                return SyncInfo.CONFLICTING | SyncInfo.CHANGE;
            else
                return SyncInfo.OUTGOING | SyncInfo.CHANGE;
        }
    } else if (isAddition(localKind)) {
        if (isAddition(repositoryKind))
            return SyncInfo.CONFLICTING | SyncInfo.ADDITION;
        return SyncInfo.OUTGOING | SyncInfo.ADDITION;
    } else if (isNotModified(localKind)) {
        if (isNotModified(repositoryKind)) {
            if ((IResource.FOLDER == local.getType() || IResource.PROJECT == local.getType()) && isOutOfDate())
                return SyncInfo.INCOMING | SyncInfo.CHANGE;
            return SyncInfo.IN_SYNC;
        }
        if ((localKind == SVNStatusKind.IGNORED) && (repositoryKind == SVNStatusKind.ADDED))
            return SyncInfo.CONFLICTING | SyncInfo.ADDITION;
        if (repositoryKind == SVNStatusKind.DELETED)
            return SyncInfo.INCOMING | SyncInfo.DELETION;
        if (repositoryKind == SVNStatusKind.ADDED)
            return SyncInfo.INCOMING | SyncInfo.ADDITION;
        if (repositoryKind == SVNStatusKind.EXTERNAL)
            return SyncInfo.IN_SYNC;
        // return SyncInfo.IN_SYNC;
        return SyncInfo.INCOMING | SyncInfo.CHANGE;
    } else if (repositoryKind == SVNStatusKind.EXTERNAL) {
        if (localKind == SVNStatusKind.EXTERNAL)
            return SyncInfo.IN_SYNC;
    } else if ((localKind == SVNStatusKind.EXTERNAL) && (remoteStatusInfo == null)) {
        return SyncInfo.IN_SYNC;
    }
    return super.calculateKind();
}
Also used : SVNStatusKind(org.tigris.subversion.svnclientadapter.SVNStatusKind) IResource(org.eclipse.core.resources.IResource)

Example 2 with SVNStatusKind

use of org.tigris.subversion.svnclientadapter.SVNStatusKind 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 3 with SVNStatusKind

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

the class GenerateDiffFileSynchronizeOperation method run.

protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    IResource[] resources = set.getResources();
    HashMap statusMap = new HashMap();
    unaddedList = new ArrayList();
    for (int i = 0; i < resources.length; i++) {
        ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
        SyncInfo syncInfo = set.getSyncInfo(resources[i]);
        SVNStatusKind statusKind = null;
        try {
            if (!svnResource.isManaged()) {
                statusKind = SVNStatusKind.UNVERSIONED;
            } else {
                switch(SyncInfo.getChange(syncInfo.getKind())) {
                    case SyncInfo.ADDITION:
                        statusKind = SVNStatusKind.ADDED;
                        break;
                    case SyncInfo.DELETION:
                        statusKind = SVNStatusKind.DELETED;
                        break;
                    case SyncInfo.CONFLICTING:
                        statusKind = SVNStatusKind.CONFLICTED;
                        break;
                    default:
                        statusKind = SVNStatusKind.MODIFIED;
                        break;
                }
            }
            statusMap.put(resources[i], statusKind);
            if (!svnResource.isManaged() && !svnResource.isIgnored())
                unaddedList.add(resources[i]);
        } catch (SVNException e) {
            SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
        }
    }
    ArrayList dedupedList = new ArrayList();
    Iterator iter = unaddedList.iterator();
    while (iter.hasNext()) {
        IResource resource = (IResource) iter.next();
        if (!isDupe(resource))
            dedupedList.add(resource);
    }
    IResource[] unversionedResources = new IResource[dedupedList.size()];
    dedupedList.toArray(unversionedResources);
    GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(new StructuredSelection(resources), unversionedResources, statusMap);
    // $NON-NLS-1$
    wizard.setWindowTitle(Policy.bind("GenerateSVNDiff.title"));
    wizard.setSelectedResources(selectedResources);
    // final WizardDialog dialog = new WizardDialog(getShell(), wizard);
    // dialog.setMinimumPageSize(350, 250);
    final WizardDialog dialog = new WizardDialogWithPersistedLocation(getShell(), wizard, // $NON-NLS-1$
    "GenerateDiffFileWizard");
    dialog.setMinimumPageSize(350, 250);
    getShell().getDisplay().syncExec(new Runnable() {

        public void run() {
            dialog.open();
        }
    });
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) GenerateDiffFileWizard(org.tigris.subversion.subclipse.ui.wizards.generatediff.GenerateDiffFileWizard) WizardDialogWithPersistedLocation(org.tigris.subversion.subclipse.ui.wizards.WizardDialogWithPersistedLocation) SyncInfo(org.eclipse.team.core.synchronize.SyncInfo) Iterator(java.util.Iterator) SVNStatusKind(org.tigris.subversion.svnclientadapter.SVNStatusKind) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IResource(org.eclipse.core.resources.IResource)

Example 4 with SVNStatusKind

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

the class ResourceWithStatusUtil method getStatusKind.

public static SVNStatusKind getStatusKind(IResource resource) {
    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
    SVNStatusKind statusKind = null;
    try {
        LocalResourceStatus status = svnResource.getStatus();
        if (status.isTextConflicted())
            statusKind = SVNStatusKind.CONFLICTED;
        else if (status.isAdded())
            statusKind = SVNStatusKind.ADDED;
        else if (status.isDeleted())
            statusKind = SVNStatusKind.DELETED;
        else if (status.isMissing())
            statusKind = SVNStatusKind.MISSING;
        else if (status.isReplaced())
            statusKind = SVNStatusKind.REPLACED;
        else if (status.isTextModified())
            statusKind = SVNStatusKind.MODIFIED;
        else if (!status.isManaged())
            statusKind = SVNStatusKind.UNVERSIONED;
    } catch (TeamException e) {
    }
    return statusKind;
}
Also used : TeamException(org.eclipse.team.core.TeamException) SVNStatusKind(org.tigris.subversion.svnclientadapter.SVNStatusKind) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)

Example 5 with SVNStatusKind

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

the class ResourceStatus method getTextStatus.

public SVNStatusKind getTextStatus() {
    SVNStatusKind statusKind = SVNStatusKind.fromInt(textStatus);
    statusKind.setTreeConflicted(treeConflicted);
    return statusKind;
}
Also used : SVNStatusKind(org.tigris.subversion.svnclientadapter.SVNStatusKind)

Aggregations

SVNStatusKind (org.tigris.subversion.svnclientadapter.SVNStatusKind)6 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)3 ArrayList (java.util.ArrayList)2 IResource (org.eclipse.core.resources.IResource)2 SVNException (org.tigris.subversion.subclipse.core.SVNException)2 LocalResourceStatus (org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)2 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 IFile (org.eclipse.core.resources.IFile)1 Path (org.eclipse.core.runtime.Path)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 TeamException (org.eclipse.team.core.TeamException)1 SyncInfo (org.eclipse.team.core.synchronize.SyncInfo)1 RemoteResourceStatus (org.tigris.subversion.subclipse.core.resources.RemoteResourceStatus)1 WizardDialogWithPersistedLocation (org.tigris.subversion.subclipse.ui.wizards.WizardDialogWithPersistedLocation)1 GenerateDiffFileWizard (org.tigris.subversion.subclipse.ui.wizards.generatediff.GenerateDiffFileWizard)1 ISVNStatus (org.tigris.subversion.svnclientadapter.ISVNStatus)1