Search in sources :

Example 31 with ISVNClientAdapter

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

the class LocalResource method getSvnProperties.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.ISVNLocalResource#getSvnProperties()
   */
public ISVNProperty[] getSvnProperties() throws SVNException {
    ISVNClientAdapter svnClient = null;
    try {
        svnClient = getRepository().getSVNClient();
        ISVNProperty[] properties = svnClient.getProperties(getFile());
        return properties;
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        getRepository().returnSVNClient(svnClient);
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 32 with ISVNClientAdapter

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

the class LogEntry method updateRootUrl.

/**
 * @param resource
 * @return rootURL
 */
private SVNUrl updateRootUrl(ISVNResource resource) {
    ISVNClientAdapter client = null;
    try {
        client = SVNProviderPlugin.getPlugin().getSVNClient();
        SVNProviderPlugin.disableConsoleLogging();
        ISVNInfo info = client.getInfo(resource.getUrl());
        SVNProviderPlugin.enableConsoleLogging();
        if (info.getRepository() == null)
            return resource.getUrl();
        else {
            // update the saved root URL
            resource.getRepository().setRepositoryRoot(info.getRepository());
            return info.getRepository();
        }
    } catch (Exception e) {
        SVNProviderPlugin.enableConsoleLogging();
        return resource.getUrl();
    } finally {
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
    }
}
Also used : ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 33 with ISVNClientAdapter

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

the class SVNRepositoryLocation method fromString.

/*
   * Parse a location string and return a SVNRepositoryLocation.
   * If useRootUrl is true, use the repository root URL.
   */
public static SVNRepositoryLocation fromString(String location, boolean validateOnly, boolean useRootUrl) throws SVNException {
    if (!useRootUrl)
        return fromString(location, validateOnly);
    ISVNClientAdapter svnClient = SVNProviderPlugin.getPlugin().getSVNClient();
    try {
        SVNUrl url = new SVNUrl(location);
        ISVNInfo info = svnClient.getInfo(url);
        SVNUrl rootUrl = info.getRepository();
        return fromString(rootUrl.toString());
    } catch (MalformedURLException e) {
        throw SVNException.wrapException(e);
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 34 with ISVNClientAdapter

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

the class SVNRepositoryLocation method validateConnection.

/*
   * Validate that the receiver contains valid information for
   * making a connection. If the receiver contains valid
   * information, the method returns. Otherwise, an exception
   * indicating the problem is throw.
   */
public void validateConnection(IProgressMonitor monitor) throws SVNException {
    ISVNClientAdapter svnClient = getSVNClient();
    try {
        // we try to get the list of directories and files using the connection
        ISVNInfo info = svnClient.getInfo(getUrl());
        repositoryRootUrl = info.getRepository();
    } catch (SVNClientException e) {
        // If the validation failed, dispose of any cached info
        dispose();
        throw SVNException.wrapException(e);
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 35 with ISVNClientAdapter

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

the class SVNHistoryPage method tagsPropertySet.

private boolean tagsPropertySet(ISVNRemoteResource resource) {
    ISVNClientAdapter client = null;
    try {
        client = SVNProviderPlugin.getPlugin().getSVNClient();
        ISVNProperty property = null;
        SVNProviderPlugin.disableConsoleLogging();
        // $NON-NLS-1$
        property = client.propertyGet(resource.getUrl(), "subclipse:tags");
        if (property != null && property.getValue() != null) {
            SVNProviderPlugin.enableConsoleLogging();
            return true;
        }
        ISVNRemoteResource checkResource = resource;
        while (checkResource.getParent() != null) {
            checkResource = checkResource.getParent();
            // $NON-NLS-1$
            property = client.propertyGet(checkResource.getUrl(), "subclipse:tags");
            if (property != null && property.getValue() != null) {
                SVNProviderPlugin.enableConsoleLogging();
                return true;
            }
        }
    } catch (Exception e) {
        SVNProviderPlugin.enableConsoleLogging();
    } finally {
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
    }
    return false;
}
Also used : ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) CoreException(org.eclipse.core.runtime.CoreException) SVNException(org.tigris.subversion.subclipse.core.SVNException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) ParseException(java.text.ParseException) 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