use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class MergeWizardBestPracticesPage method performChecks.
public void performChecks(boolean refreshPage) {
try {
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
needsChecks = false;
localMods = false;
switchedChildren = false;
mixedRevisions = false;
incompleteWorkingCopy = false;
localModsList = new ArrayList();
switchedChildrenList = new ArrayList();
mixedRevisionsList = new ArrayList();
incompleteList = new ArrayList();
IResource[] resources = ((MergeWizard) getWizard()).getResources();
if (resources == null)
return;
monitor.beginTask(Messages.MergeWizardBestPracticesPage_0, resources.length);
for (int i = 0; i < resources.length; i++) {
monitor.subTask(resources[i].getName());
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
ISVNClientAdapter svnClient = null;
try {
svnClient = svnResource.getRepository().getSVNClient();
File fileProject = new File(resources[i].getLocation().toString());
List incompleteInfoList = new ArrayList();
ISVNInfo[] infos = svnClient.getInfo(fileProject, true);
for (int j = 0; j < infos.length; j++) {
if (infos[j].getDepth() != Depth.infinity && infos[j].getDepth() != Depth.unknown) {
incompleteWorkingCopy = true;
incompleteInfoList.add(infos[j].getUrl().toString());
}
}
File file = new File(resources[i].getLocation().toString());
ISVNStatus status = svnClient.getSingleStatus(file);
highestRevision = status.getRevision().getNumber();
ISVNStatus[] statuses = svnClient.getStatus(file, true, true, false, true);
for (int j = 0; j < statuses.length; j++) {
if (statuses[j].getUrl() != null && incompleteInfoList.contains(statuses[j].getUrl().toString())) {
incompleteList.add(SVNWorkspaceRoot.getResourceFor(resources[i], statuses[j]));
}
if (statuses[j].getTextStatus().equals(SVNStatusKind.MODIFIED) | statuses[j].getPropStatus().equals(SVNStatusKind.MODIFIED)) {
localMods = true;
localModsList.add(SVNWorkspaceRoot.getResourceFor(resources[i], statuses[j]));
}
if (statuses[j].isSwitched()) {
switchedChildren = true;
switchedChildrenList.add(SVNWorkspaceRoot.getResourceFor(resources[i], statuses[j]));
}
if (!statuses[j].getTextStatus().equals(SVNStatusKind.EXTERNAL) && !statuses[j].isFileExternal() && statuses[j].getRevision() != null) {
if (!statuses[j].getRevision().equals(status.getRevision())) {
mixedRevisions = true;
if (!mixedRevisionsList.contains(resources[i]))
mixedRevisionsList.add(resources[i]);
if (statuses[j].getRevision().getNumber() > highestRevision) {
highestRevision = statuses[j].getRevision().getNumber();
}
}
}
}
} catch (Exception e) {
Activator.handleError(e);
} finally {
svnResource.getRepository().returnSVNClient(svnClient);
}
monitor.worked(1);
}
monitor.done();
}
});
} catch (Exception e) {
Activator.handleError(e);
}
if (refreshPage)
refreshPage(true, false);
if (localMods || switchedChildren || mixedRevisions || incompleteWorkingCopy) {
setMessage(Messages.MergeWizardBestPracticesPage_notReady);
setPageComplete(false);
} else {
setMessage(Messages.MergeWizardBestPracticesPage_ready);
setPageComplete(true);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class MergeCommand method run.
public void run(IProgressMonitor monitor) throws SVNException {
mergeAborted = false;
MergeListener mergeListener = null;
ISVNClientAdapter svnClient = null;
ISVNRepositoryLocation repository = null;
try {
monitor.beginTask(null, 100);
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
SVNConflictResolver conflictResolver = new SVNConflictResolver(resource, textConflictHandling, binaryConflictHandling, propertyConflictHandling, treeConflictHandling);
conflictResolver.setPart(part);
svnClient.addConflictResolutionCallback(conflictResolver);
MergeOptions mergeOptions = new MergeOptions();
mergeOptions.setFromUrl(svnUrl1);
mergeOptions.setFromRevision(svnRevision1);
mergeOptions.setToUrl(svnUrl2);
mergeOptions.setToRevision(svnRevision2);
mergeOptions.setRevisions(revisions);
mergeOptions.setForce(force);
mergeOptions.setIgnoreAncestry(ignoreAncestry);
mergeOptions.setDepth(depth);
mergeListener = new MergeListener(resource, mergeOptions, conflictResolver, mergeOutput);
svnClient.addNotifyListener(mergeListener);
svnClient.addNotifyListener(operationResourceCollector);
OperationManager.getInstance().beginOperation(svnClient, new OperationProgressNotifyListener(monitor));
monitor.subTask(resource.getName());
File file = resource.getLocation().toFile();
if (revisions == null) {
svnClient.merge(svnUrl1, svnRevision1, svnUrl2, svnRevision2, file, force, depth, false, ignoreAncestry, recordOnly);
} else {
SVNUrlWithPegRevision svnUrlWithPegRevision = new SVNUrlWithPegRevision(svnUrl1);
SVNRevision pegRevision = svnUrlWithPegRevision.getPegRevision();
if (pegRevision == null)
pegRevision = SVNRevision.HEAD;
svnClient.merge(svnUrlWithPegRevision.getUrl(), pegRevision, revisions, file, force, depth, ignoreAncestry, false, recordOnly);
}
monitor.worked(100);
} catch (SVNClientException e) {
if (e.getAprError() == SVNClientException.MERGE_CONFLICT) {
mergeAborted = true;
errorMessage = // $NON-NLS-1$ //$NON-NLS-2$
e.getCause().getLocalizedMessage().replaceAll("\n", " ");
} else
throw SVNException.wrapException(e);
} finally {
if (mergeListener != null)
mergeOutput = mergeListener.getMergeOutput();
Set<IResource> operationResources = operationResourceCollector.getOperationResources();
OperationManager.getInstance().endOperation(true, operationResources);
monitor.done();
svnClient.removeNotifyListener(mergeListener);
svnClient.removeNotifyListener(operationResourceCollector);
svnClient.addConflictResolutionCallback(null);
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class SubclipseLinkedTaskInfo method init.
private void init() {
TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
String[] urls = null;
ProjectProperties props = null;
try {
if (resource != null) {
props = ProjectProperties.getProjectProperties(resource);
} else if (logEntry != null) {
ISVNResource svnres = logEntry.getResource();
if (svnres != null) {
if (svnres.getResource() != null) {
props = ProjectProperties.getProjectProperties(svnres.getResource());
} else {
ISVNClientAdapter client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
SVNProviderPlugin.disableConsoleLogging();
ISVNProperty[] properties = client.getProperties(svnres.getUrl());
SVNProviderPlugin.enableConsoleLogging();
for (int i = 0; i < properties.length; i++) {
ISVNProperty property = properties[i];
if ("bugtraq:url".equals(property.getName())) {
repositoryUrl = SubclipseTeamPlugin.getRepository(property.getValue(), repositoryManager).getRepositoryUrl();
// comments?
}
}
}
}
}
} catch (Exception ex) {
// ignore?
SVNProviderPlugin.enableConsoleLogging();
}
if (props != null) {
if (repositoryUrl == null) {
repositoryUrl = SubclipseTeamPlugin.getRepository(props.getUrl(), repositoryManager).getRepositoryUrl();
}
urls = props.getLinkList(getText()).getUrls();
}
if (urls == null || urls.length == 0) {
urls = ProjectProperties.getUrls(getText()).getUrls();
}
if (urls != null && urls.length > 0) {
taskFullUrl = urls[0];
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class CopyCommand method run.
public void run(IProgressMonitor monitor) throws SVNException {
ISVNClientAdapter svnClient = null;
try {
monitor.beginTask(null, 100);
svnClient = root.getRepository().getSVNClient();
OperationManager.getInstance().beginOperation(svnClient);
monitor.subTask(destPath.getName());
svnClient.copy(srcUrl, destPath, svnRevision, false, true);
monitor.worked(100);
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
root.getRepository().returnSVNClient(svnClient);
OperationManager.getInstance().endOperation();
monitor.done();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class BranchTagWizardCopyPage method getSvnExternalsProperties.
private boolean getSvnExternalsProperties() {
List<SVNExternal> externalsList = new ArrayList<SVNExternal>();
ISVNClientAdapter svnClient = null;
ISVNRepositoryLocation repository = null;
try {
repository = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository();
svnClient = repository.getSVNClient();
IResource[] resources = ((BranchTagWizard) getWizard()).getResources();
for (IResource res : resources) {
ISVNProperty[] properties = svnClient.getProperties(res.getLocation().toFile(), true);
for (ISVNProperty property : properties) {
if (property.getName().equals(Policy.bind("BranchTagWizardCopyPage.8"))) {
// $NON-NLS-1$
// $NON-NLS-1$
String[] propertyLines = property.getValue().split("\\n");
for (String propertyLine : propertyLines) {
SVNExternal svnExternal = new SVNExternal(property.getFile(), propertyLine);
externalsList.add(svnExternal);
}
}
}
}
} catch (Exception e) {
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
svnExternals = new SVNExternal[externalsList.size()];
externalsList.toArray(svnExternals);
return externalsList.size() > 0;
}
Aggregations