Search in sources :

Example 81 with ISVNClientAdapter

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

the class BaseFile method getAnnotations.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.ISVNRemoteFile#getAnnotations(org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision)
   */
public ISVNAnnotations getAnnotations(SVNRevision fromRevision, SVNRevision toRevision, boolean includeMergedRevisions, boolean ignoreMimeType) throws TeamException {
    ISVNClientAdapter svnClient = getRepository().getSVNClient();
    try {
        SVNRevision pegRevision = null;
        ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
        if (localResource != null) {
            pegRevision = localResource.getRevision();
        }
        return svnClient.annotate(localResourceStatus.getFile(), fromRevision, toRevision, pegRevision, ignoreMimeType, includeMergedRevisions);
    } catch (SVNClientException e) {
        throw new TeamException("Failed in BaseFile.getAnnotations()", e);
    } finally {
        getRepository().returnSVNClient(svnClient);
    }
}
Also used : TeamException(org.eclipse.team.core.TeamException) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 82 with ISVNClientAdapter

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

the class AddIgnoredPatternCommand method run.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
   */
public void run(IProgressMonitor monitor) throws SVNException {
    monitor = Policy.monitorFor(monitor);
    // $NON-NLS-1$
    monitor.beginTask(null, 100);
    if (!folder.getStatus().isManaged())
        throw new SVNException(IStatus.ERROR, TeamException.UNABLE, Policy.bind("SVNTeamProvider.ErrorSettingIgnorePattern", // $NON-NLS-1$
        folder.getIResource().getFullPath().toString()));
    ISVNClientAdapter svnClient = folder.getRepository().getSVNClient();
    try {
        OperationManager.getInstance().beginOperation(svnClient);
        try {
            svnClient.addToIgnoredPatterns(folder.getFile(), pattern);
            // broadcast changes to unmanaged children - they are the only candidates for being ignored
            ISVNResource[] members = folder.members(null, ISVNFolder.UNMANAGED_MEMBERS);
            IResource[] possiblesIgnores = new IResource[members.length];
            for (int i = 0; i < members.length; i++) {
                possiblesIgnores[i] = ((ISVNLocalResource) members[i]).getIResource();
            }
            folder.refreshStatus(false);
            SVNProviderPlugin.broadcastSyncInfoChanges(possiblesIgnores, false);
            broadcastNestedFolders(possiblesIgnores);
        } catch (SVNClientException e) {
            throw SVNException.wrapException(e);
        }
    } finally {
        OperationManager.getInstance().endOperation();
        monitor.done();
        folder.getRepository().returnSVNClient(svnClient);
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNResource(org.tigris.subversion.subclipse.core.ISVNResource) SVNException(org.tigris.subversion.subclipse.core.SVNException) IResource(org.eclipse.core.resources.IResource) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 83 with ISVNClientAdapter

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

the class ChangeCommitPropertiesCommand method run.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
   */
public void run(IProgressMonitor monitor) throws SVNException {
    // $NON-NLS-1$
    monitor.beginTask(null, 100);
    ISVNClientAdapter svnClient = repositoryLocation.getSVNClient();
    try {
        OperationManager.getInstance().beginOperation(svnClient);
        try {
            if (logMessage != null) {
                svnClient.setRevProperty(repositoryLocation.getUrl(), revisionNo, "svn:log", logMessage, true);
                logMessageChanged = true;
            }
            if (author != null) {
                svnClient.setRevProperty(repositoryLocation.getUrl(), revisionNo, "svn:author", author, true);
                authorChanged = true;
            }
        } catch (SVNClientException e) {
            throw SVNException.wrapException(e);
        }
    } finally {
        repositoryLocation.returnSVNClient(svnClient);
        OperationManager.getInstance().endOperation();
        monitor.done();
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 84 with ISVNClientAdapter

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

the class ResolveResourcesCommand method run.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
   */
public void run(IProgressMonitor monitor) throws SVNException {
    ISVNClientAdapter svnClient = root.getRepository().getSVNClient();
    try {
        svnClient.addNotifyListener(operationResourceCollector);
        OperationManager.getInstance().beginOperation(svnClient);
        for (int i = 0; i < resources.length; i++) {
            svnClient.resolve(resources[i].getLocation().toFile(), resolution);
            monitor.worked(100);
        }
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        Set<IResource> operationResources = operationResourceCollector.getOperationResources();
        OperationManager.getInstance().endOperation(true, operationResources);
        if (svnClient != null) {
            svnClient.removeNotifyListener(operationResourceCollector);
            root.getRepository().returnSVNClient(svnClient);
        }
        monitor.done();
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) IResource(org.eclipse.core.resources.IResource) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 85 with ISVNClientAdapter

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

the class SwitchToUrlCommand method run.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
   */
public void run(final IProgressMonitor monitor) throws SVNException {
    final ISVNClientAdapter svnClient = root.getRepository().getSVNClient();
    OperationManager.getInstance().beginOperation(svnClient, new OperationProgressNotifyListener(monitor, svnClient));
    try {
        SVNProviderPlugin.run(new ISVNRunnable() {

            public void run(IProgressMonitor monitor) throws SVNException {
                try {
                    monitor.beginTask(null, Policy.INFINITE_PM_GUESS_FOR_SWITCH);
                    if (conflictResolver != null) {
                        svnClient.addConflictResolutionCallback(conflictResolver);
                    }
                    svnClient.addNotifyListener(operationResourceCollector);
                    File file = resource.getLocation().toFile();
                    svnClient.switchToUrl(file, svnUrl, svnRevision, svnRevision, depth, setDepth, ignoreExternals, force, ignoreAncestry);
                    OperationManager.getInstance().onNotify(resource.getLocation().toFile(), SVNNodeKind.UNKNOWN);
                } catch (SVNClientException e) {
                    throw SVNException.wrapException(e);
                } finally {
                    if (svnClient != null) {
                        if (conflictResolver != null) {
                            svnClient.addConflictResolutionCallback(null);
                        }
                        root.getRepository().returnSVNClient(svnClient);
                    }
                    monitor.done();
                }
            }
        }, resource.getProject(), Policy.monitorFor(monitor));
    } finally {
        Set<IResource> operationResources = operationResourceCollector.getOperationResources();
        if (operationResources.size() == 0) {
            IResource[] resources = SVNWorkspaceRoot.getResourcesFor(resource);
            for (IResource refreshResource : resources) {
                operationResources.add(refreshResource);
            }
        }
        OperationManager.getInstance().endOperation(true, operationResources);
    }
}
Also used : ISVNRunnable(org.tigris.subversion.subclipse.core.ISVNRunnable) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) SVNException(org.tigris.subversion.subclipse.core.SVNException) File(java.io.File) IResource(org.eclipse.core.resources.IResource) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter) OperationProgressNotifyListener(org.tigris.subversion.subclipse.core.client.OperationProgressNotifyListener)

Aggregations

ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)108 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)67 SVNException (org.tigris.subversion.subclipse.core.SVNException)37 File (java.io.File)28 IResource (org.eclipse.core.resources.IResource)27 CoreException (org.eclipse.core.runtime.CoreException)22 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)21 TeamException (org.eclipse.team.core.TeamException)21 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)20 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)20 ISVNInfo (org.tigris.subversion.svnclientadapter.ISVNInfo)19 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)19 ArrayList (java.util.ArrayList)18 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)18 InvocationTargetException (java.lang.reflect.InvocationTargetException)15 ISVNProperty (org.tigris.subversion.svnclientadapter.ISVNProperty)13 OperationProgressNotifyListener (org.tigris.subversion.subclipse.core.client.OperationProgressNotifyListener)9 IProject (org.eclipse.core.resources.IProject)8 List (java.util.List)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)7