use of org.tigris.subversion.svnclientadapter.ISVNInfo 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.ISVNInfo 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();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNInfo in project subclipse by subclipse.
the class GetRemoteResourceCommand method run.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
*/
public void run(IProgressMonitor monitor) throws SVNException {
monitor = Policy.monitorFor(monitor);
// $NON-NLS-1$
monitor.beginTask(Policy.bind("GetRemoteResourceCommand.getLogEntries"), 100);
remoteResource = null;
ISVNClientAdapter svnClient = repository.getSVNClient();
ISVNInfo info;
try {
info = svnClient.getInfo(url, revision, revision);
} catch (SVNClientException e) {
throw new SVNException("Can't get remote resource " + url + " at revision " + revision, e);
} finally {
repository.returnSVNClient(svnClient);
}
if (info == null) {
// no remote file
remoteResource = null;
} else {
if (info.getNodeKind() == SVNNodeKind.FILE)
remoteResource = new RemoteFile(// we don't know its parent
null, repository, url, revision, info.getLastChangedRevision(), info.getLastChangedDate(), info.getLastCommitAuthor());
else
remoteResource = new RemoteFolder(// we don't know its parent
null, repository, url, revision, info.getLastChangedRevision(), info.getLastChangedDate(), info.getLastCommitAuthor());
}
monitor.done();
}
use of org.tigris.subversion.svnclientadapter.ISVNInfo in project subclipse by subclipse.
the class GetStatusCommand 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) {
ISVNClientAdapter svnClient = null;
String url = status.getUrlString();
if (url == null && !(status.getTextStatus() == SVNStatusKind.UNVERSIONED)) {
try {
svnClient = repository.getSVNClient();
ISVNInfo info = svnClient.getInfoFromWorkingCopy(status.getFile());
SVNUrl svnurl = info.getUrl();
url = (svnurl != null) ? svnurl.toString() : null;
} catch (SVNException e) {
} catch (SVNClientException e) {
} finally {
repository.returnSVNClient(svnClient);
}
}
return url;
}
use of org.tigris.subversion.svnclientadapter.ISVNInfo in project subclipse by subclipse.
the class SVNRepositoryLocation method getRemoteFile.
/*
* (non-Javadoc)
* @see org.tigris.subversion.subclipse.core.ISVNRepositoryLocation#getRemoteFile(org.tigris.subversion.svnclientadapter.SVNUrl)
*/
public ISVNRemoteFile getRemoteFile(SVNUrl url) throws SVNException {
ISVNClientAdapter svnClient = getSVNClient();
ISVNInfo info = null;
try {
if (this.getRepositoryRoot().equals(url))
return new RemoteFile(this, url, SVNRevision.HEAD);
else
info = svnClient.getInfo(url, SVNRevision.HEAD, SVNRevision.HEAD);
} catch (SVNClientException e) {
throw new SVNException("Can't get latest remote resource for " + url);
}
if (// no remote file
info == null)
// no remote file
return null;
else {
return new RemoteFile(// we don't know its parent
null, this, url, SVNRevision.HEAD, info.getLastChangedRevision(), info.getLastChangedDate(), info.getLastCommitAuthor());
}
}
Aggregations