use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class StatusCacheManager method getURL.
// getStatuses returns null URL for svn:externals folder. This will
// get the URL using svn info command on the local resource
private String getURL(ISVNStatus status) {
String url = status.getUrlString();
if (url == null && !(status.getTextStatus() == SVNStatusKind.UNVERSIONED) && !(status.getTextStatus() == SVNStatusKind.IGNORED)) {
ISVNClientAdapter svnClient = null;
try {
svnClient = SVNProviderPlugin.getPlugin().getSVNClient();
SVNProviderPlugin.disableConsoleLogging();
ISVNInfo info = svnClient.getInfoFromWorkingCopy(status.getFile());
SVNUrl svnurl = info.getUrl();
url = (svnurl != null) ? svnurl.toString() : null;
} catch (SVNException e) {
} catch (SVNClientException e) {
} finally {
SVNProviderPlugin.enableConsoleLogging();
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
}
}
return url;
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class BranchTagAction method run.
public void run() {
BranchTagWizard wizard;
final IResource resource = ((RevisionGraphEditorInput) editor.getEditorInput()).getResource();
ISVNRemoteResource remoteResource = ((RevisionGraphEditorInput) editor.getEditorInput()).getRemoteResource();
if (resource == null) {
ISVNRemoteResource[] resources = { remoteResource };
wizard = new BranchTagWizard(resources);
} else {
IResource[] resources = { resource };
wizard = new BranchTagWizard(resources);
}
wizard.setRevisionNumber(node.getRevision());
WizardDialog dialog = new ClosableWizardDialog(Display.getDefault().getActiveShell(), wizard);
if (dialog.open() == WizardDialog.OK) {
final SVNUrl sourceUrl = wizard.getUrl();
final SVNUrl destinationUrl = wizard.getToUrl();
final String message = wizard.getComment();
final SVNRevision revision = wizard.getRevision();
final boolean makeParents = wizard.isMakeParents();
final SVNUrl[] sourceUrls = wizard.getUrls();
final boolean createOnServer = wizard.isCreateOnServer();
final Alias newAlias = wizard.getNewAlias();
final boolean switchAfter = wizard.isSwitchAfterBranchTag();
try {
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ISVNClientAdapter client = null;
try {
if (resource == null) {
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
client.copy(sourceUrl, destinationUrl, message, revision, makeParents);
} else {
IResource[] resources = { resource };
BranchTagOperation branchTagOperation = new BranchTagOperation(editor.getEditorSite().getPart(), resources, sourceUrls, destinationUrl, createOnServer, revision, message);
branchTagOperation.setMakeParents(makeParents);
branchTagOperation.setNewAlias(newAlias);
branchTagOperation.switchAfterTagBranchOperation(switchAfter);
branchTagOperation.run();
}
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("HistoryView.createTagFromRevision"), e.getMessage());
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
});
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("HistoryView.createTagFromRevision"), e.getMessage());
}
}
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class CompareRevisionsAction method run.
public void run() {
RevisionGraphEditorInput input = (RevisionGraphEditorInput) editor.getEditorInput();
boolean isFolder = (input.getResource() != null && input.getResource().getType() != IResource.FILE) || (input.getRemoteResource() != null && input.getRemoteResource().isFolder());
ISVNInfo info = input.getInfo();
try {
ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(info.getRepository().toString());
ISVNRemoteResource remoteResource1;
ISVNRemoteResource remoteResource2;
if (isFolder) {
remoteResource1 = new RemoteFolder(repository, new SVNUrl(repository.getLocation() + node1.getBranch().getPath()), new SVNRevision.Number(node1.getRevision()));
remoteResource2 = new RemoteFolder(repository, new SVNUrl(repository.getLocation() + node2.getBranch().getPath()), new SVNRevision.Number(node2.getRevision()));
} else {
remoteResource1 = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node1.getBranch().getPath()), new SVNRevision.Number(node1.getRevision()));
remoteResource2 = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node2.getBranch().getPath()), new SVNRevision.Number(node2.getRevision()));
}
ISVNRemoteResource[] selectedResources = { remoteResource1, remoteResource2 };
DifferencesDialog dialog = new DifferencesDialog(Display.getDefault().getActiveShell(), null, selectedResources, editor.getEditorSite().getPart());
dialog.setFromRevision(Long.toString(node1.getRevision()));
dialog.setToRevision(Long.toString(node2.getRevision()));
dialog.open();
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Compare Revisions", e.getMessage());
}
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class CheckoutCommand method scrubProject.
/*
* Delete the target projects before checking out
* @param monitor - may be null !
*/
private void scrubProject(ISVNRemoteFolder resource, IProject project, IProgressMonitor monitor) throws SVNException {
if (project == null) {
if (monitor != null) {
monitor.done();
}
return;
}
if (monitor != null) {
monitor.beginTask("", 100);
monitor.subTask(// $NON-NLS-1$
Policy.bind("SVNProvider.Scrubbing_local_project_1", project.getName()));
}
try {
File destPath = null;
if (projectRoot != null) {
destPath = new File(projectRoot.toFile(), project.getName());
}
// New location, just delete the project but not the content.
if (destPath != null && !destPath.exists() && project != null && project.exists()) {
project.delete(IResource.NEVER_DELETE_PROJECT_CONTENT, monitor);
project = null;
}
if (project != null && project.exists() && (destPath == null || destPath.exists())) {
if (!project.isOpen()) {
project.open((monitor != null) ? Policy.subMonitorFor(monitor, 10) : null);
}
// unmap the project from any previous repository provider
if (RepositoryProvider.getProvider(project) != null)
RepositoryProvider.unmap(project);
IResource[] children = project.members(IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS);
IProgressMonitor subMonitor = (monitor != null) ? Policy.subMonitorFor(monitor, 80) : null;
if (subMonitor != null) {
subMonitor.beginTask(null, children.length * 100);
}
ISVNClientAdapter clientSilent = null;
try {
for (int j = 0; j < children.length; j++) {
if (!children[j].getName().equals(".project")) {
// $NON-NLS-1$
if (clientSilent == null)
clientSilent = SVNProviderPlugin.getPlugin().getSVNClient();
ISVNInfo info = null;
try {
SVNUrl url = new SVNUrl(resource.getUrl().toString() + "/" + children[j].getProjectRelativePath());
try {
SVNProviderPlugin.disableConsoleLogging();
info = clientSilent.getInfo(url);
} catch (SVNClientException e2) {
} finally {
SVNProviderPlugin.enableConsoleLogging();
}
} catch (MalformedURLException e1) {
}
if (info != null)
children[j].delete(true, /* force */
(subMonitor != null) ? Policy.subMonitorFor(subMonitor, 100) : null);
}
}
} finally {
if (subMonitor != null) {
subMonitor.done();
}
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(clientSilent);
}
} else if (project != null) {
// Make sure there is no directory in the local file system.
File location = new File(project.getParent().getLocation().toFile(), project.getName());
if (location.exists()) {
deepDelete(location);
}
}
} catch (CoreException e) {
throw SVNException.wrapException(e);
} finally {
if (monitor != null) {
monitor.subTask(" ");
monitor.done();
}
}
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class GetLogsCommand method run.
/**
* execute the command
*
* @param aMonitor
* @throws SVNException
*/
public void run(IProgressMonitor aMonitor) throws SVNException {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
logEntries = null;
IProgressMonitor monitor = Policy.monitorFor(aMonitor);
// $NON-NLS-1$
monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100);
ISVNLogMessage[] logMessages;
try {
if (callback == null) {
logMessages = remoteResource.getLogMessages(pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions);
} else {
repository = remoteResource.getRepository();
svnClient = repository.getSVNClient();
if (remoteResource instanceof BaseResource) {
boolean logMessagesRetrieved = false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(remoteResource.getResource());
if (svnResource != null) {
LocalResourceStatus status = svnResource.getStatus();
if (status != null && status.isCopied()) {
ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile());
SVNUrl copiedFromUrl = info.getCopyUrl();
if (copiedFromUrl != null) {
svnClient.getLogMessages(copiedFromUrl, SVNRevision.HEAD, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
logMessagesRetrieved = true;
GetRemoteResourceCommand getRemoteResourceCommand = new GetRemoteResourceCommand(remoteResource.getRepository(), copiedFromUrl, SVNRevision.HEAD);
getRemoteResourceCommand.run(null);
remoteResource = getRemoteResourceCommand.getRemoteResource();
}
}
}
if (!logMessagesRetrieved)
svnClient.getLogMessages(((BaseResource) remoteResource).getFile(), pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
} else {
svnClient.getLogMessages(remoteResource.getUrl(), pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
}
logMessages = callback.getLogMessages();
}
if (remoteResource.isFolder()) {
logEntries = LogEntry.createLogEntriesFrom((ISVNRemoteFolder) remoteResource, logMessages, getTags(logMessages));
} else {
logEntries = LogEntry.createLogEntriesFrom((ISVNRemoteFile) remoteResource, logMessages, getTags(logMessages), getUrls(logMessages));
}
} catch (Exception e) {
throw SVNException.wrapException(e);
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
monitor.done();
}
}
Aggregations