use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter 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();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class RepositoryResourcesManager method deleteRemoteResources.
/**
* delete some remote resources Resources can be from several RemoteRepositoryLocations
*/
public void deleteRemoteResources(ISVNRemoteResource[] remoteResources, String message, IProgressMonitor monitor) throws SVNException {
IProgressMonitor progress = Policy.monitorFor(monitor);
progress.beginTask(Policy.bind("RepositoryResourcesManager.deleteRemoteResources"), // $NON-NLS-1$
100 * remoteResources.length);
// the given remote resources can come from more than a repository and so needs
// more than one svnClient
// we associate each repository with the corresponding resources to delete
HashMap<ISVNRepositoryLocation, List<ISVNRemoteResource>> mapRepositories = new HashMap<ISVNRepositoryLocation, List<ISVNRemoteResource>>();
for (ISVNRemoteResource remoteResource : remoteResources) {
ISVNRepositoryLocation repositoryLocation = remoteResource.getRepository();
List<ISVNRemoteResource> resources = (List<ISVNRemoteResource>) mapRepositories.get(repositoryLocation);
if (resources == null) {
resources = new ArrayList<ISVNRemoteResource>();
mapRepositories.put(repositoryLocation, resources);
}
resources.add(remoteResource);
}
ISVNClientAdapter svnClient = null;
ISVNRepositoryLocation repository = null;
try {
for (List<ISVNRemoteResource> resources : mapRepositories.values()) {
repository = (resources.get(0)).getRepository();
svnClient = repository.getSVNClient();
SVNUrl[] urls = new SVNUrl[resources.size()];
for (int i = 0; i < resources.size(); i++) {
ISVNRemoteResource resource = resources.get(i);
urls[i] = resource.getUrl();
// refresh just says that resource needs to be updated
// it does not update immediatly
resource.getParent().refresh();
}
svnClient.remove(urls, message);
repository.returnSVNClient(svnClient);
svnClient = null;
repository = null;
for (ISVNRemoteResource resource : resources) {
remoteResourceDeleted(resource);
}
progress.worked(100 * urls.length);
}
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
progress.done();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter 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());
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class LocalFile method removeKeywords.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.core.ISVNLocalFile#removeKeywords(org.tigris.subversion.svnclientadapter.SVNKeywords)
*/
public void removeKeywords(SVNKeywords svnKeywords) throws SVNException {
ISVNClientAdapter svnClient = null;
try {
svnClient = getRepository().getSVNClient();
OperationManager.getInstance().beginOperation(svnClient);
svnClient.removeKeywords(getFile(), svnKeywords);
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
getRepository().returnSVNClient(svnClient);
OperationManager.getInstance().endOperation();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class LocalResource method getPropertiesIncludingInherited.
public ISVNProperty[] getPropertiesIncludingInherited(boolean includeEmptyProperties, boolean includeClosestOnly, List<String> filterProperties) throws SVNException {
ISVNClientAdapter svnClient = null;
try {
svnClient = SVNProviderPlugin.getPlugin().getSVNClient();
SVNProviderPlugin.disableConsoleLogging();
ISVNProperty[] properties = svnClient.getPropertiesIncludingInherited(getFile(), includeEmptyProperties, includeClosestOnly, filterProperties);
return properties;
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
SVNProviderPlugin.enableConsoleLogging();
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
}
}
Aggregations