Search in sources :

Example 1 with SVNUrlWithPegRevision

use of org.tigris.subversion.subclipse.core.util.SVNUrlWithPegRevision in project subclipse by subclipse.

the class MergeWizardAdvancedPage method getUrl.

private String getUrl(String url) {
    if (url != null) {
        try {
            SVNUrlWithPegRevision svnUrlWithPegRevision = new SVNUrlWithPegRevision(new SVNUrl(url));
            SVNUrl svnUrl = svnUrlWithPegRevision.getUrl();
            if (svnUrl != null)
                return svnUrl.toString();
        } catch (MalformedURLException e) {
        }
    }
    return url;
}
Also used : MalformedURLException(java.net.MalformedURLException) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SVNUrlWithPegRevision(org.tigris.subversion.subclipse.core.util.SVNUrlWithPegRevision)

Example 2 with SVNUrlWithPegRevision

use of org.tigris.subversion.subclipse.core.util.SVNUrlWithPegRevision in project subclipse by subclipse.

the class MergeWizardRevisionsPage method getUrl.

private String getUrl() {
    if (fromUrl != null) {
        try {
            SVNUrlWithPegRevision svnUrlWithPegRevision = new SVNUrlWithPegRevision(new SVNUrl(fromUrl));
            SVNUrl svnUrl = svnUrlWithPegRevision.getUrl();
            if (svnUrl != null)
                return svnUrl.toString();
        } catch (MalformedURLException e) {
        }
    }
    return fromUrl;
}
Also used : MalformedURLException(java.net.MalformedURLException) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SVNUrlWithPegRevision(org.tigris.subversion.subclipse.core.util.SVNUrlWithPegRevision)

Example 3 with SVNUrlWithPegRevision

use of org.tigris.subversion.subclipse.core.util.SVNUrlWithPegRevision in project subclipse by subclipse.

the class MergeCommand method run.

public void run(IProgressMonitor monitor) throws SVNException {
    mergeAborted = false;
    MergeListener mergeListener = null;
    ISVNClientAdapter svnClient = null;
    ISVNRepositoryLocation repository = null;
    try {
        monitor.beginTask(null, 100);
        ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
        repository = svnResource.getRepository();
        svnClient = repository.getSVNClient();
        SVNConflictResolver conflictResolver = new SVNConflictResolver(resource, textConflictHandling, binaryConflictHandling, propertyConflictHandling, treeConflictHandling);
        conflictResolver.setPart(part);
        svnClient.addConflictResolutionCallback(conflictResolver);
        MergeOptions mergeOptions = new MergeOptions();
        mergeOptions.setFromUrl(svnUrl1);
        mergeOptions.setFromRevision(svnRevision1);
        mergeOptions.setToUrl(svnUrl2);
        mergeOptions.setToRevision(svnRevision2);
        mergeOptions.setRevisions(revisions);
        mergeOptions.setForce(force);
        mergeOptions.setIgnoreAncestry(ignoreAncestry);
        mergeOptions.setDepth(depth);
        mergeListener = new MergeListener(resource, mergeOptions, conflictResolver, mergeOutput);
        svnClient.addNotifyListener(mergeListener);
        svnClient.addNotifyListener(operationResourceCollector);
        OperationManager.getInstance().beginOperation(svnClient, new OperationProgressNotifyListener(monitor));
        monitor.subTask(resource.getName());
        File file = resource.getLocation().toFile();
        if (revisions == null) {
            svnClient.merge(svnUrl1, svnRevision1, svnUrl2, svnRevision2, file, force, depth, false, ignoreAncestry, recordOnly);
        } else {
            SVNUrlWithPegRevision svnUrlWithPegRevision = new SVNUrlWithPegRevision(svnUrl1);
            SVNRevision pegRevision = svnUrlWithPegRevision.getPegRevision();
            if (pegRevision == null)
                pegRevision = SVNRevision.HEAD;
            svnClient.merge(svnUrlWithPegRevision.getUrl(), pegRevision, revisions, file, force, depth, ignoreAncestry, false, recordOnly);
        }
        monitor.worked(100);
    } catch (SVNClientException e) {
        if (e.getAprError() == SVNClientException.MERGE_CONFLICT) {
            mergeAborted = true;
            errorMessage = // $NON-NLS-1$ //$NON-NLS-2$
            e.getCause().getLocalizedMessage().replaceAll("\n", " ");
        } else
            throw SVNException.wrapException(e);
    } finally {
        if (mergeListener != null)
            mergeOutput = mergeListener.getMergeOutput();
        Set<IResource> operationResources = operationResourceCollector.getOperationResources();
        OperationManager.getInstance().endOperation(true, operationResources);
        monitor.done();
        svnClient.removeNotifyListener(mergeListener);
        svnClient.removeNotifyListener(operationResourceCollector);
        svnClient.addConflictResolutionCallback(null);
        if (repository != null) {
            repository.returnSVNClient(svnClient);
        }
    }
}
Also used : ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) SVNUrlWithPegRevision(org.tigris.subversion.subclipse.core.util.SVNUrlWithPegRevision) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) 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

SVNUrlWithPegRevision (org.tigris.subversion.subclipse.core.util.SVNUrlWithPegRevision)3 MalformedURLException (java.net.MalformedURLException)2 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)2 File (java.io.File)1 IResource (org.eclipse.core.resources.IResource)1 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)1 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)1 OperationProgressNotifyListener (org.tigris.subversion.subclipse.core.client.OperationProgressNotifyListener)1 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)1 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)1 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)1