use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class UpdateSynchronizeOperation method groupByRepository.
/**
* This takes the items we are going to update and groups them by repository We need to do this in
* case a project uses svn:externals to point to a different repository. If we do not do this,
* then later when we find the highest revision number to update to, we can have a set of
* resources that span multiple repositories (each with their own revision numbers)
*
* @param resourceArray - Complete list of resources we will update
* @param set - The set of selected items in the synch view
* @return Map - the resources grouped by ISVNRepositoryLocation
*/
private Map<ISVNRepositoryLocation, List<IResource>> groupByRepository(IResource[] resourceArray, SyncInfoSet set) {
Map<ISVNRepositoryLocation, List<IResource>> resourceMap = new HashMap<ISVNRepositoryLocation, List<IResource>>();
final SyncInfo[] syncInfos = set.getSyncInfos();
for (int i = 0; i < syncInfos.length; i++) {
SVNStatusSyncInfo syncInfo = (SVNStatusSyncInfo) syncInfos[i];
IResource local = syncInfo.getLocal();
resourceLoop: for (int j = 0; j < resourceArray.length; j++) {
if (resourceArray[j].equals(local)) {
IResourceVariant remote = syncInfo.getRemote();
if (remote != null && remote instanceof ISVNRemoteResource) {
if (syncInfo.getRemoteResourceStatus() != null) {
ISVNRepositoryLocation repos = syncInfo.getRemoteResourceStatus().getRepository();
List<IResource> resList = (List<IResource>) resourceMap.get(repos);
if (resList == null)
resList = new ArrayList<IResource>(resourceArray.length);
resList.add(resourceArray[j]);
resourceMap.put(repos, resList);
}
}
break resourceLoop;
}
}
}
return resourceMap;
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class UpdateSynchronizeOperation method getRevisionForUpdate.
/**
* This method returns the highest revision number in the set of items being updated or
* SVNRevision.HEAD if there are deleted items
*
* @param resources - the resources being updated
* @param set - the list of all selected items in synch view
* @return
*/
private SVNRevision getRevisionForUpdate(IResource[] resources, SyncInfoSet set) {
SVNRevision revision = null;
final SyncInfo[] syncInfos = set.getSyncInfos();
boolean useHEAD = false;
syncInfoLoop: for (int i = 0; i < syncInfos.length; i++) {
SVNStatusSyncInfo syncInfo = (SVNStatusSyncInfo) syncInfos[i];
resourceLoop: for (int j = 0; j < resources.length; j++) {
if (resources[j].equals(syncInfo.getLocal())) {
IResourceVariant remote = syncInfo.getRemote();
if (remote != null && remote instanceof ISVNRemoteResource) {
if (syncInfo.getRemoteResourceStatus() != null) {
if (syncInfo.getRemoteResourceStatus().getTextStatus() == SVNStatusKind.DELETED) {
// update contains deleted items
useHEAD = true;
break syncInfoLoop;
}
}
SVNRevision rev = ((ISVNRemoteResource) remote).getLastChangedRevision();
if (rev instanceof SVNRevision.Number) {
long nbr = ((SVNRevision.Number) rev).getNumber();
if (revision == null)
revision = rev;
else {
long revisionNumber = ((SVNRevision.Number) revision).getNumber();
if (nbr > revisionNumber)
revision = rev;
}
}
}
break resourceLoop;
}
}
}
if (revision == null || useHEAD)
revision = SVNRevision.HEAD;
return revision;
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class SvnRevPropertiesView method getSvnRevProperties.
private ISVNProperty[] getSvnRevProperties() throws SVNException {
if (resource != null && resource.isManaged()) {
SVNRevision rev = resource.getRevision();
ISVNRemoteResource remoteResource = resource.getRemoteResource(rev);
return UnversionedCustomProperty.getSvnRevisionProperties(remoteResource.getUrl(), rev, null);
}
if (remoteResource != null) {
SVNRevision rev = remoteResource.getRevision();
return UnversionedCustomProperty.getSvnRevisionProperties(remoteResource.getUrl(), rev, null);
}
return null;
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class SvnWizardUpdatePage method showLog.
protected void showLog() {
ISVNRemoteResource remoteResource = null;
try {
remoteResource = SVNWorkspaceRoot.getSVNResourceFor(resources[0]).getRepository().getRemoteFile(new SVNUrl(commonRoot));
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), // $NON-NLS-1$
e.toString());
return;
}
if (remoteResource == null) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), Policy.bind("MergeDialog.urlError") + " " + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
commonRoot);
return;
}
HistoryDialog dialog = new HistoryDialog(getShell(), remoteResource);
if (dialog.open() == HistoryDialog.CANCEL)
return;
ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
if (selectedEntries.length == 0)
return;
revisionText.setText(Long.toString(selectedEntries[selectedEntries.length - 1].getRevision().getNumber()));
setPageComplete(canFinish());
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class ChooseUrlDialog method okPressed.
protected void okPressed() {
saveLocation();
ISelection selection = treeViewer.getSelection();
if (!selection.isEmpty() && (selection instanceof IStructuredSelection)) {
IStructuredSelection structured = (IStructuredSelection) selection;
Object first = structured.getFirstElement();
if (first instanceof ISVNRemoteResource) {
url = ((ISVNRemoteResource) first).getUrl().toString();
name = ((ISVNRemoteResource) first).getName();
}
if (first instanceof ISVNRepositoryLocation)
url = ((ISVNRepositoryLocation) first).getUrl().toString();
if (first instanceof Alias)
url = AliasManager.transformUrl(resource, (Alias) first);
ArrayList urlArray = new ArrayList();
ArrayList nameArray = new ArrayList();
Iterator iter = structured.iterator();
while (iter.hasNext()) {
Object selectedItem = iter.next();
if (selectedItem instanceof ISVNRemoteResource) {
urlArray.add(((ISVNRemoteResource) selectedItem).getUrl().toString());
nameArray.add(((ISVNRemoteResource) selectedItem).getName());
}
}
urls = new String[urlArray.size()];
urlArray.toArray(urls);
names = new String[nameArray.size()];
nameArray.toArray(names);
}
super.okPressed();
}
Aggregations