Search in sources :

Example 61 with ISVNClientAdapter

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

the class RecursiveStatusUpdateStrategy method statusesToUpdate.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.status.StatusUpdateStrategy#statusesToUpdate(org.eclipse.core.resources.IResource)
   */
protected ISVNStatus[] statusesToUpdate(IResource resource) throws SVNException {
    if (!(resource instanceof IProject)) {
        // if the status of the resource parent is not known, we
        // recursively update it instead
        IContainer parent = resource.getParent();
        if (parent != null) {
            if (statusCache.getStatus(parent) == null) {
                return statusesToUpdate(parent);
            }
        }
    }
    if (Policy.DEBUG_STATUS) {
        // $NON-NLS-1$
        System.out.println("[svn] getting status for : " + resource.getFullPath());
    }
    // don't do getRepository().getSVNClient() as we can ask the status of a file
    // that is not associated with a known repository
    // we don't need login & password so this is not a problem
    ISVNStatus[] statuses = null;
    ISVNClientAdapter svnClientAdapterStatus = null;
    try {
        SVNProviderPlugin.disableConsoleLogging();
        svnClientAdapterStatus = SVNProviderPlugin.getPlugin().getSVNClient();
        statuses = svnClientAdapterStatus.getStatus(resource.getLocation().toFile(), true, true);
    } catch (SVNClientException e1) {
        if (!e1.getMessage().contains(SVNProviderPlugin.UPGRADE_NEEDED)) {
            throw SVNException.wrapException(e1);
        }
    } finally {
        SVNProviderPlugin.enableConsoleLogging();
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClientAdapterStatus);
    }
    return collectUnversionedFolders(statuses, true);
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNStatus(org.tigris.subversion.svnclientadapter.ISVNStatus) IContainer(org.eclipse.core.resources.IContainer) IProject(org.eclipse.core.resources.IProject) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 62 with ISVNClientAdapter

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

the class LocalFile method addKeywords.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.ISVNLocalFile#addKeywords(org.tigris.subversion.svnclientadapter.SVNKeywords)
   */
public void addKeywords(SVNKeywords svnKeywords) throws SVNException {
    ISVNClientAdapter svnClient = null;
    try {
        svnClient = getRepository().getSVNClient();
        OperationManager.getInstance().beginOperation(svnClient);
        svnClient.addKeywords(getFile(), svnKeywords);
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        getRepository().returnSVNClient(svnClient);
        OperationManager.getInstance().endOperation();
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 63 with ISVNClientAdapter

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

the class LocalFile method setKeywords.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.ISVNLocalFile#setKeywords(org.tigris.subversion.svnclientadapter.SVNKeywords)
   */
public void setKeywords(SVNKeywords svnKeywords) throws SVNException {
    ISVNClientAdapter svnClient = null;
    try {
        svnClient = getRepository().getSVNClient();
        OperationManager.getInstance().beginOperation(svnClient);
        svnClient.setKeywords(getFile(), svnKeywords, false);
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        getRepository().returnSVNClient(svnClient);
        OperationManager.getInstance().endOperation();
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 64 with ISVNClientAdapter

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

the class LocalResource method deleteSvnProperty.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.ISVNLocalResource#deleteSvnProperty(java.lang.String, boolean)
   */
public void deleteSvnProperty(String name, boolean recurse) throws SVNException {
    OperationResourceCollector operationResourceCollector = new OperationResourceCollector();
    ISVNClientAdapter svnClient = getRepository().getSVNClient();
    try {
        svnClient.addNotifyListener(operationResourceCollector);
        OperationManager.getInstance().beginOperation(svnClient);
        svnClient.propertyDel(getFile(), name, recurse);
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        OperationManager.getInstance().endOperation(true, operationResourceCollector.getOperationResources());
        if (svnClient != null) {
            svnClient.removeNotifyListener(operationResourceCollector);
            getRepository().returnSVNClient(svnClient);
        }
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) OperationResourceCollector(org.tigris.subversion.subclipse.core.client.OperationResourceCollector) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 65 with ISVNClientAdapter

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

the class LocalResource method setSvnProperty.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.ISVNLocalResource#setSvnProperty(java.lang.String, java.io.File, boolean)
   */
public void setSvnProperty(String name, File value, boolean recurse) throws SVNException {
    OperationResourceCollector operationResourceCollector = new OperationResourceCollector();
    ISVNClientAdapter svnClient = getRepository().getSVNClient();
    try {
        svnClient.addNotifyListener(operationResourceCollector);
        OperationManager.getInstance().beginOperation(svnClient);
        svnClient.propertySet(getFile(), name, value, recurse);
    } catch (IOException e) {
        throw SVNException.wrapException(e);
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        OperationManager.getInstance().endOperation(true, operationResourceCollector.getOperationResources());
        if (svnClient != null) {
            svnClient.removeNotifyListener(operationResourceCollector);
            getRepository().returnSVNClient(svnClient);
        }
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) OperationResourceCollector(org.tigris.subversion.subclipse.core.client.OperationResourceCollector) IOException(java.io.IOException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

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