use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class PropertyCompareRemoteResourceNode method getProperties.
public void getProperties(boolean recursive) {
ISVNClientAdapter svnClient = null;
try {
svnClient = remoteResource.getRepository().getSVNClient();
properties = svnClient.getProperties(remoteResource.getUrl(), remoteResource.getRevision(), pegRevision, recursive);
} catch (Exception e) {
SVNUIPlugin.log(Status.ERROR, e.getMessage(), e);
} finally {
remoteResource.getRepository().returnSVNClient(svnClient);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class MergeWizardStandardPage method initializeLocations.
private void initializeLocations() {
MergeWizard wizard = (MergeWizard) getWizard();
resource = wizard.getResource();
resources = wizard.getResources();
svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
mergeInfoPaths = null;
try {
fromUrl = svnResource.getStatus().getUrlString();
} catch (Exception e) {
Activator.handleError(e);
}
repositoryLocation = svnResource.getRepository().getLocation();
if (((MergeWizard) getWizard()).suggestMergeSources()) {
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.setTaskName(Messages.MergeWizardStandardPage_retrievingMergeSourceInfo);
monitor.beginTask(Messages.MergeWizardStandardPage_retrievingMergeSourceInfo, IProgressMonitor.UNKNOWN);
// $NON-NLS-1$
monitor.subTask("");
ISVNClientAdapter svnClient = null;
try {
svnClient = svnResource.getRepository().getSVNClient();
try {
if (unblock) {
try {
mergeInfo = svnClient.getMergeInfo(new SVNUrl(commonRoot), SVNRevision.HEAD);
} catch (Exception e) {
}
if (mergeInfo != null)
mergeInfoPaths = mergeInfo.getPaths();
if (mergeInfoPaths == null || mergeInfoPaths.length == 0) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
setErrorMessage(Messages.MergeWizardStandardPage_noRevisionsToUnblock);
}
});
}
} else {
mergeInfoPaths = svnClient.suggestMergeSources(new SVNUrl(commonRoot), SVNRevision.HEAD);
}
} catch (Exception e1) {
}
} catch (Exception e) {
Activator.handleError(e);
} finally {
svnResource.getRepository().returnSVNClient(svnClient);
}
monitor.done();
}
};
try {
getContainer().run(true, false, runnable);
} catch (Exception e2) {
Activator.handleError(e2);
}
}
boolean valueAdded = false;
List<String> fromUrls = new ArrayList<String>();
if (mergeInfoPaths != null) {
for (int i = 0; i < mergeInfoPaths.length; i++) {
String url = mergeInfoPaths[i].substring(repositoryLocation.length());
if (!fromUrls.contains(url))
fromUrls.add(url);
valueAdded = true;
}
}
String previousFromUrls = null;
String previousFromUrl = null;
try {
previousFromUrls = Activator.getDefault().getDialogSettings().get("mergeFromUrls_" + commonRoot);
} catch (Exception e) {
}
if (previousFromUrls != null) {
String[] urls = previousFromUrls.split("\\,");
for (String url : urls) {
if (!fromUrls.contains(url))
fromUrls.add(url);
valueAdded = true;
}
if (urls.length > 0)
previousFromUrl = urls[0];
}
if (!valueAdded && !unblock && commonRoot != null) {
fromUrls.add(commonRoot.substring(repositoryLocation.length()));
}
for (String url : fromUrls) {
fromCombo.add(url);
}
if (previousFromUrl != null)
fromCombo.setText(previousFromUrl);
else if (fromCombo.getItemCount() > 0)
fromCombo.setText(fromCombo.getItem(0));
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class SVNUIPlugin method passwordStoresConfiguredOnLinux.
public boolean passwordStoresConfiguredOnLinux() {
if (System.getProperty("os.name").toLowerCase().indexOf("linux") == -1) {
return false;
}
String svnInterface = getPreferenceStore().getString(ISVNUIConstants.PREF_SVNINTERFACE);
if (svnInterface != null && !svnInterface.equals("javahl")) {
return false;
}
boolean passwordStoresFound = false;
boolean valueIsGnomeKeyring = false;
File configFile = getConfigFile();
if (!configFile.exists()) {
ISVNClientAdapter client = null;
try {
// This is ja hack to cause the config file to be created so that we
// can offer to fix it. We are using a non-existant path so that it will
// just end quickly.
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
client.cleanup(new File("/This/is/just/a/dummy/file"));
} catch (Exception e) {
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
if (!configFile.exists())
return false;
BufferedReader input = null;
try {
input = new BufferedReader(new FileReader(configFile));
String line = null;
while ((line = input.readLine()) != null) {
if (line.startsWith("password-stores =")) {
passwordStoresFound = true;
if (!line.trim().endsWith("password-stores =")) {
valueIsGnomeKeyring = line.indexOf("gnome-keyring") != -1;
}
break;
}
if (line.startsWith("password-stores=")) {
passwordStoresFound = true;
if (!line.trim().endsWith("password-stores=")) {
valueIsGnomeKeyring = line.indexOf("gnome-keyring") != -1;
}
break;
}
}
} catch (Exception e) {
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
}
}
}
return valueIsGnomeKeyring || !passwordStoresFound;
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class UndoMergeCommand method run.
public void run(IProgressMonitor monitor) throws SVNException {
ISVNClientAdapter svnClient = null;
ISVNRepositoryLocation repository = null;
try {
final OperationManager operationManager = OperationManager.getInstance();
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
svnClient.addNotifyListener(operationResourceCollector);
operationManager.beginOperation(svnClient);
LocalResourceStatus status = SVNWorkspaceRoot.getSVNResourceFor(resource).getStatus();
if (!status.isManaged()) {
try {
resource.delete(true, monitor);
} catch (CoreException ex) {
throw SVNException.wrapException(ex);
}
} else {
File path = resource.getLocation().toFile();
svnClient.revert(path, true);
if (resource.getType() != IResource.FILE)
operationManager.onNotify(path, SVNNodeKind.UNKNOWN);
monitor.worked(100);
}
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
OperationManager.getInstance().endOperation(true, operationResourceCollector.getOperationResources());
monitor.done();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class RepositoryBranchTagAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
ISVNRemoteResource[] resources = getSelectedRemoteResources();
BranchTagWizard wizard = new BranchTagWizard(resources);
WizardDialog dialog = // $NON-NLS-1$
new SizePersistedWizardDialog(getShell(), wizard, "BranchTag");
if (dialog.open() == WizardDialog.OK) {
SVNUrl[] sourceUrls = wizard.getUrls();
SVNUrl destinationUrl = wizard.getToUrl();
String message = wizard.getComment();
SVNRevision revision = wizard.getRevision();
boolean makeParents = wizard.isMakeParents();
ISVNClientAdapter client = null;
try {
ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
if (repository != null)
client = repository.getSVNClient();
if (client == null)
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
branchTagOperation.run();
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
} finally {
// BranchTagCommand will dispose.
// SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
}
Aggregations