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;
}
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;
}
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);
}
}
}
Aggregations