use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class MergeOutput method resume.
public void resume() {
IDialogSettings settings = Activator.getDefault().getDialogSettings();
IResource[] resources = { resource };
SVNUrl[] fromUrls = { mergeOptions.getFromUrl() };
SVNUrl[] toUrls = { mergeOptions.getToUrl() };
MergeOperation mergeOperation = new MergeOperation(SVNUIPlugin.getActivePage().getActivePart(), resources, fromUrls, mergeOptions.getFromRevision(), toUrls, mergeOptions.getToRevision(), mergeOptions.getRevisions(), this);
mergeOperation.setForce(mergeOptions.isForce());
mergeOperation.setIgnoreAncestry(mergeOptions.isIgnoreAncestry());
mergeOperation.setDepth(mergeOptions.getDepth());
int lastTextConflictChoice = ISVNConflictResolver.Choice.chooseMerged;
try {
lastTextConflictChoice = settings.getInt(LAST_TEXT_CONFLICT_CHOICE);
} catch (Exception e) {
}
int lastPropertyConflictChoice = lastTextConflictChoice;
try {
lastPropertyConflictChoice = settings.getInt(LAST_PROPERTY_CONFLICT_CHOICE);
} catch (Exception e) {
}
int lastBinaryConflictChoice = ISVNConflictResolver.Choice.chooseMerged;
try {
lastBinaryConflictChoice = settings.getInt(LAST_BINARY_CONFLICT_CHOICE);
} catch (Exception e) {
}
int lastTreeConflictChoice = ISVNConflictResolver.Choice.postpone;
try {
lastTreeConflictChoice = settings.getInt(LAST_TREE_CONFLICT_CHOICE);
} catch (Exception e) {
}
mergeOperation.setTextConflictHandling(lastTextConflictChoice);
mergeOperation.setBinaryConflictHandling(lastBinaryConflictChoice);
mergeOperation.setPropertyConflictHandling(lastPropertyConflictChoice);
mergeOperation.setTreeConflictHandling(lastTreeConflictChoice);
try {
mergeOperation.run();
} catch (Exception e) {
Activator.handleError(Messages.MergeOutput_resumeError, e);
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MergeOutput_resume, e.getMessage());
}
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class CopyFromMergeSourceAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
Iterator iter = selection.iterator();
while (iter.hasNext()) {
Object object = iter.next();
if (object instanceof ISkippedMergeResult) {
SVNRevision svnRevision = null;
IResource resource = null;
SVNUrl srcUrl = null;
MergeResult mergeResult = null;
if (object instanceof SkippedMergeResult) {
SkippedMergeResult skippedMergeResult = (SkippedMergeResult) object;
mergeResult = skippedMergeResult;
MergeOptions mergeOptions = skippedMergeResult.getMergeOutput().getMergeOptions();
svnRevision = mergeOptions.getToRevision();
SVNUrl svnUrl = mergeOptions.getFromUrl();
resource = skippedMergeResult.getResource();
if (!resource.exists()) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
String resourceSubString = resource.getFullPath().toOSString().substring(skippedMergeResult.getMergeOutput().getTarget().length() + 1);
if (!resourceSubString.startsWith("/"))
// $NON-NLS-1$ //$NON-NLS-2$
resourceSubString = "/" + resourceSubString;
try {
srcUrl = new SVNUrl(svnUrl.toString() + // $NON-NLS-1$ //$NON-NLS-2$
resourceSubString.replaceAll("\\\\", "/"));
} catch (MalformedURLException e) {
Activator.handleError(Messages.CopyFromMergeSourceAction_error, e);
MessageDialog.openError(getShell(), Messages.CopyFromMergeSourceAction_title, e.getLocalizedMessage());
return;
}
}
}
if (object instanceof SkippedMergeResultsFolder) {
SkippedMergeResultsFolder skippedMergeResultsFolder = (SkippedMergeResultsFolder) object;
mergeResult = skippedMergeResultsFolder.getMergeResult();
MergeOptions mergeOptions = skippedMergeResultsFolder.getMergeOutput().getMergeOptions();
svnRevision = mergeOptions.getToRevision();
SVNUrl svnUrl = mergeOptions.getFromUrl();
resource = skippedMergeResultsFolder.getFolder();
if (!resource.exists()) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
String resourceSubString = resource.getFullPath().toOSString().substring(skippedMergeResultsFolder.getMergeOutput().getTarget().length() + 1);
if (!resourceSubString.startsWith("/"))
// $NON-NLS-1$ //$NON-NLS-2$
resourceSubString = "/" + resourceSubString;
try {
srcUrl = new SVNUrl(svnUrl.toString() + // $NON-NLS-1$ //$NON-NLS-2$
resourceSubString.replaceAll("\\\\", "/"));
} catch (MalformedURLException e) {
Activator.handleError(Messages.CopyFromMergeSourceAction_error2, e);
MessageDialog.openError(getShell(), Messages.CopyFromMergeSourceAction_title, e.getLocalizedMessage());
return;
}
}
}
if (resource.exists()) {
MessageDialog.openError(getShell(), Messages.CopyFromMergeSourceAction_title, resource.getName() + Messages.CopyFromMergeSourceAction_alreadyExists);
return;
}
if (svnRevision == null)
svnRevision = SVNRevision.HEAD;
IResource[] resources = { resource };
File destPath = new File(resource.getLocation().toOSString());
CopyOperation copyOperation = new CopyOperation(getTargetPart(), resources, srcUrl, destPath, svnRevision, mergeResult);
copyOperation.run();
}
}
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class BranchTagWizardCopyPage method showLog.
private void showLog() {
ISVNRemoteResource remoteResource = null;
if (((BranchTagWizard) getWizard()).multipleSelections()) {
ISVNRepositoryLocation repository = null;
if (resource == null)
repository = this.remoteResource.getRepository();
else
repository = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository();
try {
remoteResource = repository.getRemoteFile(new SVNUrl(((BranchTagWizard) getWizard()).getCommonRoot()));
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), // $NON-NLS-1$
e.toString());
return;
}
} else {
if (resource == null)
remoteResource = this.remoteResource;
else {
try {
remoteResource = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().getRemoteFile(((BranchTagWizard) getWizard()).getUrl());
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), // $NON-NLS-1$
e.toString());
return;
}
}
if (remoteResource == null) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), Policy.bind("MergeDialog.urlError") + " " + ((BranchTagWizard) getWizard()).getUrlText());
return;
}
}
HistoryDialog dialog = new HistoryDialog(getShell(), remoteResource);
if (dialog.open() == HistoryDialog.CANCEL)
return;
ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
if (selectedEntries.length == 0)
return;
revisionText.setText(Long.toString(selectedEntries[selectedEntries.length - 1].getRevision().getNumber()));
setPageComplete(canFinish());
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class ProjectProperties method resolveUrl.
private static String resolveUrl(String url, ISVNLocalResource svnResource) {
String resolvedUrl = null;
// Relative to repository root, with navigators.
if (url.startsWith("^/")) {
SVNUrl repositoryUrl = svnResource.getRepository().getUrl();
String path = url.substring(1);
while (path.startsWith("/..")) {
if (repositoryUrl.getParent() == null)
break;
repositoryUrl = repositoryUrl.getParent();
path = path.substring(3);
}
resolvedUrl = repositoryUrl + path;
} else // Relative to host.
if (url.startsWith("/")) {
String resourceUrl = svnResource.getUrl().toString();
String protocol = svnResource.getUrl().getProtocol();
int start = protocol.length();
while (resourceUrl.substring(start, start + 1).equals(":") || resourceUrl.substring(start, start + 1).equals("/")) start++;
int end = resourceUrl.indexOf("/", start);
if (end == -1)
resolvedUrl = resourceUrl + url;
else
resolvedUrl = resourceUrl.substring(0, end) + url;
} else
// Non-relative
resolvedUrl = url;
return resolvedUrl;
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class ShowDifferencesAsUnifiedDiffAction method execute.
//
// private IResource localResource;
//
// public void setLocalResource(IResource localResource) {
// this.localResource = localResource;
// }
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
pegRevision1 = null;
pegRevision2 = null;
String fromRevision = null;
String toRevision = null;
ISVNResource[] selectedResources = getSelectedRemoteResources();
SVNUrl fromUrl = null;
SVNUrl toUrl = null;
if (selectedResources == null || (selectedResources.length == 0)) {
Object[] selectedObjects = selection.toArray();
if (selectedObjects[0] instanceof ILogEntry) {
selectedResources = new ISVNResource[2];
selectedResources[0] = ((ILogEntry) selectedObjects[0]).getResource();
fromRevision = ((ILogEntry) selectedObjects[0]).getRevision().toString();
ILogEntry logEntry1 = (ILogEntry) selectedObjects[0];
RemoteResource remoteResource;
IResource resource1 = logEntry1.getResource().getResource();
if (resource1 != null) {
try {
ISVNRemoteResource baseResource = SVNWorkspaceRoot.getBaseResourceFor(resource1);
if (baseResource != null) {
pegRevision1 = baseResource.getLastChangedRevision();
}
} catch (Exception e) {
}
}
if (logEntry1.getResource().getResource() instanceof IContainer) {
remoteResource = new RemoteFolder(logEntry1.getResource().getRepository(), logEntry1.getResource().getUrl(), logEntry1.getRevision());
} else {
remoteResource = new RemoteFile(logEntry1.getResource().getRepository(), logEntry1.getResource().getUrl(), logEntry1.getRevision());
}
fromUrl = remoteResource.getUrl();
if (selectedObjects.length > 1) {
selectedResources[1] = ((ILogEntry) selectedObjects[1]).getResource();
toRevision = ((ILogEntry) selectedObjects[1]).getRevision().toString();
ILogEntry logEntry2 = (ILogEntry) selectedObjects[1];
IResource resource2 = logEntry2.getResource().getResource();
if (resource2 != null) {
try {
ISVNRemoteResource baseResource = SVNWorkspaceRoot.getBaseResourceFor(resource2);
if (baseResource != null) {
pegRevision2 = baseResource.getLastChangedRevision();
}
} catch (Exception e) {
}
}
if (logEntry2.getResource().getResource() instanceof IContainer) {
remoteResource = new RemoteFolder(logEntry2.getResource().getRepository(), logEntry2.getResource().getUrl(), logEntry2.getRevision());
} else {
remoteResource = new RemoteFile(logEntry2.getResource().getRepository(), logEntry2.getResource().getUrl(), logEntry2.getRevision());
}
toUrl = remoteResource.getUrl();
} else {
int from = Integer.parseInt(fromRevision);
from--;
toRevision = Integer.toString(from);
toUrl = remoteResource.getUrl();
}
}
} else {
if (selectedResources[0] instanceof ISVNRemoteResource)
fromRevision = ((ISVNRemoteResource) selectedResources[0]).getRevision().toString();
if (selectedResources.length > 1 && selectedResources[1] instanceof ISVNRemoteResource)
toRevision = ((ISVNRemoteResource) selectedResources[1]).getRevision().toString();
}
if (pegRevision1 == null) {
pegRevision1 = SVNRevision.HEAD;
}
if (pegRevision2 == null) {
pegRevision2 = pegRevision1;
}
DifferencesDialog dialog = new DifferencesDialog(getShell(), null, selectedResources, new SVNRevision[] { pegRevision1, pegRevision2 }, getTargetPart());
dialog.setUsePegRevision(usePegRevision);
dialog.setFromUrl(fromUrl);
dialog.setToUrl(toUrl);
IResource localResource = null;
IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
if (part instanceof GenericHistoryView) {
IHistoryPage historyPage = ((GenericHistoryView) part).getHistoryPage();
if (historyPage instanceof SVNHistoryPage) {
localResource = ((SVNHistoryPage) historyPage).getResource();
}
}
dialog.setLocalResource(localResource);
// $NON-NLS-1$
if (!fromRevision.equals("HEAD"))
dialog.setFromRevision(fromRevision);
if (toRevision != null && !toRevision.equals("HEAD"))
// $NON-NLS-1$
dialog.setToRevision(toRevision);
dialog.open();
}
Aggregations