Search in sources :

Example 16 with ISVNInfo

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

the class CommitOperation method getSVNInfo.

private ISVNInfo getSVNInfo(ISVNLocalResource localResource) {
    if (!atomicCommit)
        return null;
    if (localResource == null)
        return null;
    File file = localResource.getFile();
    if (file == null)
        return null;
    boolean returnSVNClient = svnClient == null;
    if (svnClient == null) {
        try {
            svnClient = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
        } catch (SVNException e) {
            return null;
        }
    }
    ISVNInfo info;
    try {
        SVNProviderPlugin.disableConsoleLogging();
        info = svnClient.getInfoFromWorkingCopy(file);
        SVNProviderPlugin.enableConsoleLogging();
    } catch (SVNClientException e) {
        SVNProviderPlugin.enableConsoleLogging();
        return null;
    } finally {
        if (returnSVNClient) {
            SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
        }
    }
    return info;
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) SVNException(org.tigris.subversion.subclipse.core.SVNException) File(java.io.File)

Example 17 with ISVNInfo

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

the class CommitOperation method getRootURL.

private String getRootURL(ISVNLocalResource localResource) {
    if (!atomicCommit)
        return null;
    ISVNInfo info = getSVNInfo(localResource);
    if (info == null)
        return null;
    SVNUrl repos = info.getRepository();
    if (repos == null)
        return null;
    return repos.toString();
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo)

Example 18 with ISVNInfo

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

the class BranchTagWizard method performFinish.

public boolean performFinish() {
    if (confirmUserData() == false) {
        return false;
    }
    svnExternals = copyPage.getSvnExternals();
    comment = commentPage.getComment();
    repositoryPage.saveUrl();
    createOnServer = !copyPage.workingCopyButton.getSelection();
    makeParents = repositoryPage.makeParentsButton.getSelection();
    sameStructure = repositoryPage.sameStructureButton != null && repositoryPage.sameStructureButton.getSelection();
    if (commentPage.switchAfterBranchTagCheckBox != null) {
        switchAfterBranchTag = commentPage.switchAfterBranchTagCheckBox.getSelection();
    }
    if (copyPage.serverButton.getSelection())
        revision = SVNRevision.HEAD;
    try {
        toUrl = new SVNUrl(repositoryPage.getToUrl());
        if (copyPage.revisionButton.getSelection())
            revision = SVNRevision.getRevision(copyPage.getRevision());
    } catch (Exception e) {
        MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), // $NON-NLS-1$
        e.getMessage());
        return false;
    }
    if (!multipleSelections()) {
        BusyIndicator.showWhile(Display.getDefault(), new Runnable() {

            public void run() {
                ISVNInfo svnInfo = null;
                SVNUrl[] sourceUrls = getUrls();
                ISVNClientAdapter svnClient = null;
                ISVNRepositoryLocation repository = null;
                try {
                    SVNProviderPlugin.disableConsoleLogging();
                    repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
                    svnClient = repository.getSVNClient();
                    svnInfo = svnClient.getInfo(toUrl);
                } catch (Exception e) {
                } finally {
                    SVNProviderPlugin.enableConsoleLogging();
                    if (repository != null) {
                        repository.returnSVNClient(svnClient);
                    }
                }
                alreadyExists = svnInfo != null;
            }
        });
        if (alreadyExists) {
            MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), Policy.bind("BranchTagDialog.alreadyExists", // $NON-NLS-1$ //$NON-NLS-2$
            toUrl.toString()));
            return false;
        }
    }
    if (resources != null)
        updateTagsProperty(toUrl);
    return true;
}
Also used : ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 19 with ISVNInfo

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

the class SVNWorkspaceRoot method setSharing.

/**
 * Set the sharing for a project to enable it to be used with the SVNTeamProvider. This is used
 * when a project has .svn directory but is not shared in Eclipse. An exception is thrown if
 * project does not have a remote directory counterpart
 */
public static void setSharing(IProject project, IProgressMonitor monitor) throws TeamException {
    // Ensure provided info matches that of the project
    LocalResourceStatus status = peekResourceStatusFor(project);
    // we will change this exception !
    if (!status.hasRemote())
        throw new SVNException(new SVNStatus(IStatus.ERROR, // $NON-NLS-1$
        Policy.bind("SVNProvider.infoMismatch", project.getName())));
    String repositoryURL = null;
    ISVNClientAdapter client = SVNProviderPlugin.getPlugin().getSVNClient();
    try {
        SVNProviderPlugin.disableConsoleLogging();
        ISVNInfo info = client.getInfoFromWorkingCopy(project.getLocation().toFile());
        if (info.getRepository() != null)
            repositoryURL = info.getRepository().toString();
    } catch (SVNClientException e) {
    } finally {
        SVNProviderPlugin.enableConsoleLogging();
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
    }
    if (repositoryURL == null)
        repositoryURL = status.getUrlString();
    // Ensure that the provided location is managed
    SVNProviderPlugin.getPlugin().getRepositories().getRepository(repositoryURL, false);
    // Register the project with Team
    RepositoryProvider.map(project, SVNProviderPlugin.getTypeId());
}
Also used : SVNStatus(org.tigris.subversion.subclipse.core.SVNStatus) ISVNStatus(org.tigris.subversion.svnclientadapter.ISVNStatus) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 20 with ISVNInfo

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

the class RevisionDetailsAction method run.

public void run() {
    remoteResource = null;
    logEntry = null;
    includeTags = SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE);
    BusyIndicator.showWhile(Display.getDefault(), new Runnable() {

        public void run() {
            try {
                RevisionGraphEditorInput input = (RevisionGraphEditorInput) editor.getEditorInput();
                ISVNInfo info = input.getInfo();
                ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(info.getRepository().toString());
                remoteResource = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node.getPath()), new SVNRevision.Number(node.getRevision()));
                AliasManager tagManager = null;
                if (includeTags)
                    tagManager = new AliasManager(remoteResource.getUrl());
                SVNRevision pegRevision = new SVNRevision.Number(node.getRevision());
                SVNRevision revisionStart = new SVNRevision.Number(node.getRevision());
                SVNRevision revisionEnd = new SVNRevision.Number(node.getRevision());
                GetLogsCommand logCmd = new GetLogsCommand(remoteResource, pegRevision, revisionStart, revisionEnd, false, 0, tagManager, true);
                logCmd.run(null);
                ILogEntry[] logEntries = logCmd.getLogEntries();
                if (logEntries != null && logEntries.length > 0) {
                    logEntry = logEntries[0];
                }
            } catch (Exception e) {
                MessageDialog.openError(Display.getDefault().getActiveShell(), "Revision Info", e.getMessage());
            }
        }
    });
    if (logEntry != null) {
        ShowRevisionsDialog dialog = new ShowRevisionsDialog(Display.getDefault().getActiveShell(), logEntry, remoteResource, includeTags, null);
        dialog.setTitle("Revision Info");
        dialog.setSelectFirst(true);
        dialog.open();
    }
}
Also used : AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ShowRevisionsDialog(org.tigris.subversion.subclipse.ui.dialogs.ShowRevisionsDialog) GetLogsCommand(org.tigris.subversion.subclipse.core.commands.GetLogsCommand) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Aggregations

ISVNInfo (org.tigris.subversion.svnclientadapter.ISVNInfo)26 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)19 SVNException (org.tigris.subversion.subclipse.core.SVNException)13 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)12 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)8 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)7 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)5 IResource (org.eclipse.core.resources.IResource)4 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)4 File (java.io.File)3 MalformedURLException (java.net.MalformedURLException)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 Alias (org.tigris.subversion.subclipse.core.history.Alias)3 RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)3 RevisionGraphEditorInput (org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput)3 ISVNProperty (org.tigris.subversion.svnclientadapter.ISVNProperty)3 ArrayList (java.util.ArrayList)2 CoreException (org.eclipse.core.runtime.CoreException)2 ISVNRemoteFile (org.tigris.subversion.subclipse.core.ISVNRemoteFile)2 LocalResourceStatus (org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)2