use of org.tigris.subversion.svnclientadapter.SVNUrl 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.SVNUrl in project subclipse by subclipse.
the class PeekStatusCommand 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 && info != null) {
SVNUrl svnurl = info.getUrl();
url = (svnurl != null) ? svnurl.toString() : null;
}
return url;
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class ShareProjectCommand 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 {
// Determine if the repository is known
boolean alreadyExists = SVNProviderPlugin.getPlugin().getRepositories().isKnownRepository(location.getLocation(), false);
final ISVNClientAdapter svnClient = location.getSVNClient();
try {
// perform the workspace modifications in a runnable
SVNProviderPlugin.run(new ISVNRunnable() {
public void run(IProgressMonitor pm) throws SVNException {
String message;
if (comment == null)
// $NON-NLS-1$
message = Policy.bind("SVNProvider.initialImport");
else
message = comment;
try {
// create the remote dir
SVNUrl url = location.getUrl().appendPath(remoteDirName);
if (createDirectory)
svnClient.mkdir(url, true, message);
try {
OperationManager.getInstance().beginOperation(svnClient, new OperationProgressNotifyListener(pm, svnClient));
// checkout it so that we have .svn
// If directory already existed in repository, do recursive checkout.
svnClient.checkout(url, project.getLocation().toFile(), SVNRevision.HEAD, !createDirectory);
} finally {
OperationManager.getInstance().endOperation();
}
} catch (SVNClientException e) {
throw new SVNException("Error while creating module: " + e.getMessage(), e);
}
// SharingWizard.doesSVNDirectoryExist calls
// getStatus on the folder which populates the
// status cache
// Need to clear the cache so we can get the new
// hasRemote value
SVNProviderPlugin.getPlugin().getStatusCacheManager().refreshStatus(project, true);
try {
// Register it with Team.
RepositoryProvider.map(project, SVNProviderPlugin.getTypeId());
} catch (TeamException e) {
throw new SVNException("Cannot register project with svn provider", e);
}
}
}, monitor);
} catch (SVNException e) {
// its cache
if (!alreadyExists)
SVNProviderPlugin.getPlugin().getRepositories().disposeRepository(location);
throw e;
} finally {
location.returnSVNClient(svnClient);
}
// Add the repository if it didn't exist already
if (!alreadyExists)
SVNProviderPlugin.getPlugin().getRepositories().addOrUpdateRepository(location);
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class LocalResource method getUrl.
/**
* get the url of the resource in the repository The resource does not need to exist in repository
*
* @return the url or null if cannot get the url (when project is not managed)
* @throws SVNException
*/
public SVNUrl getUrl() {
try {
LocalResourceStatus status = getStatusFromCache();
if (status.isManaged()) {
// if the resource is managed, get the url directly
return status.getUrl();
} else {
// otherwise, get the url of the parent
SVNUrl parentUrl = null;
ISVNLocalResource parent = getParent();
if (parent != null) {
parentUrl = parent.getUrl();
}
if (parentUrl == null) {
// we cannot find the url
return null;
}
return parentUrl.appendPath(resource.getName());
}
} catch (SVNException e) {
return null;
}
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class RepositoryResourcesManager method moveRemoteResource.
public void moveRemoteResource(ISVNRemoteResource resource, ISVNRemoteFolder destinationFolder, String destinationResourceName, String message, IProgressMonitor monitor) throws SVNException {
IProgressMonitor progress = Policy.monitorFor(monitor);
progress.beginTask(Policy.bind("RepositoryResourcesManager.moveRemoteResources"), // $NON-NLS-1$
100);
ISVNClientAdapter svnClient = null;
try {
svnClient = resource.getRepository().getSVNClient();
SVNUrl destUrl = destinationFolder.getUrl().appendPath(destinationResourceName);
svnClient.move(resource.getUrl(), destUrl, message, SVNRevision.HEAD);
resource.getParent().refresh();
destinationFolder.refresh();
remoteResourceMoved(resource, destinationFolder, destinationResourceName);
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
resource.getRepository().returnSVNClient(svnClient);
progress.done();
}
}
Aggregations