use of org.tigris.subversion.svnclientadapter.ISVNInfo in project subclipse by subclipse.
the class LogEntry method updateRootUrl.
/**
* @param resource
* @return rootURL
*/
private SVNUrl updateRootUrl(ISVNResource resource) {
ISVNClientAdapter client = null;
try {
client = SVNProviderPlugin.getPlugin().getSVNClient();
SVNProviderPlugin.disableConsoleLogging();
ISVNInfo info = client.getInfo(resource.getUrl());
SVNProviderPlugin.enableConsoleLogging();
if (info.getRepository() == null)
return resource.getUrl();
else {
// update the saved root URL
resource.getRepository().setRepositoryRoot(info.getRepository());
return info.getRepository();
}
} catch (Exception e) {
SVNProviderPlugin.enableConsoleLogging();
return resource.getUrl();
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNInfo in project subclipse by subclipse.
the class SVNRepositoryLocation method fromString.
/*
* Parse a location string and return a SVNRepositoryLocation.
* If useRootUrl is true, use the repository root URL.
*/
public static SVNRepositoryLocation fromString(String location, boolean validateOnly, boolean useRootUrl) throws SVNException {
if (!useRootUrl)
return fromString(location, validateOnly);
ISVNClientAdapter svnClient = SVNProviderPlugin.getPlugin().getSVNClient();
try {
SVNUrl url = new SVNUrl(location);
ISVNInfo info = svnClient.getInfo(url);
SVNUrl rootUrl = info.getRepository();
return fromString(rootUrl.toString());
} catch (MalformedURLException e) {
throw SVNException.wrapException(e);
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNInfo in project subclipse by subclipse.
the class SVNRepositoryLocation method validateConnection.
/*
* Validate that the receiver contains valid information for
* making a connection. If the receiver contains valid
* information, the method returns. Otherwise, an exception
* indicating the problem is throw.
*/
public void validateConnection(IProgressMonitor monitor) throws SVNException {
ISVNClientAdapter svnClient = getSVNClient();
try {
// we try to get the list of directories and files using the connection
ISVNInfo info = svnClient.getInfo(getUrl());
repositoryRootUrl = info.getRepository();
} catch (SVNClientException e) {
// If the validation failed, dispose of any cached info
dispose();
throw SVNException.wrapException(e);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNInfo in project subclipse by subclipse.
the class ShowDifferencesAsUnifiedDiffDialogWC method okPressed.
protected void okPressed() {
success = true;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
try {
if (toHeadButton.getSelection())
toRevision = SVNRevision.HEAD;
else {
int toRevisionInt = Integer.parseInt(toRevisionText.getText().trim());
long toRevisionLong = toRevisionInt;
toRevision = new SVNRevision.Number(toRevisionLong);
}
toUrl = new SVNUrl(toUrlText.getText().trim());
File path = new File(resource.getLocation().toString());
svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
pegRevision = null;
if (toUrlText.getText().equals(selectedResourceUrl)) {
ISVNRemoteResource baseResource = svnResource.getBaseResource();
if (baseResource != null) {
pegRevision = baseResource.getLastChangedRevision();
}
}
if (pegRevision == null) {
pegRevision = toRevision;
}
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
ISVNInfo svnInfo = svnClient.getInfo(toUrl, toRevision, pegRevision);
SVNNodeKind nodeKind = svnInfo.getNodeKind();
if (resource instanceof IContainer) {
if (nodeKind.toInt() == SVNNodeKind.FILE.toInt()) {
MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.fileToFolder"));
success = false;
return;
}
} else {
if (nodeKind.toInt() == SVNNodeKind.DIR.toInt()) {
MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.fileToFolder"));
success = false;
return;
}
}
if (diffButton.getSelection()) {
diffToOutputFile = true;
file = new File(fileText.getText().trim());
if (file.exists()) {
if (!MessageDialog.openQuestion(getShell(), Policy.bind("HistoryView.showDifferences"), Policy.bind("HistoryView.overwriteOutfile", file.getName())))
return;
}
operation = new ShowDifferencesAsUnifiedDiffOperationWC(targetPart, path, toUrl, toRevision, file);
operation.setGraphicalCompare(true);
} else {
diffToOutputFile = false;
success = true;
}
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("HistoryView.showDifferences"), e.getMessage());
success = false;
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
}
});
if (!success)
return;
toUrlText.saveUrl();
super.okPressed();
}
use of org.tigris.subversion.svnclientadapter.ISVNInfo in project subclipse by subclipse.
the class SVNPropertyPage method getStatus.
private void getStatus() {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
try {
IResource resource = (IResource) getElement();
SVNTeamProvider svnProvider = (SVNTeamProvider) RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId());
if (svnProvider == null)
return;
svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
if (svnResource == null)
return;
status = svnResource.getStatus();
if (status != null && !status.isIgnored()) {
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile());
urlCopiedFrom = info.getCopyUrl();
revision = svnResource.getRevision();
lockOwnerText = status.getLockOwner();
lockCommentText = status.getLockComment();
if (status.getLockCreationDate() != null)
lockDateText = status.getLockCreationDate().toString();
if (!status.isAdded()) {
try {
info = svnClient.getInfo(status.getUrl());
} catch (Exception e) {
}
}
// Get lock information from server if svn:needs-lock property is set
if (info != null && status.getLockOwner() == null && status.getUrlString() != null) {
ISVNProperty prop = svnResource.getSvnProperty("svn:needs-lock");
if (prop != null) {
lockOwnerText = info.getLockOwner();
if (info.getLockCreationDate() != null)
lockDateText = info.getLockCreationDate().toString();
lockCommentText = info.getLockComment();
}
}
}
} catch (Exception e) {
SVNUIPlugin.log(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, "Property Exception", // $NON-NLS-1$
e));
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
}
Aggregations