use of org.tigris.subversion.subclipse.core.sync.SVNStatusSyncInfo 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.sync.SVNStatusSyncInfo 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.sync.SVNStatusSyncInfo in project subclipse by subclipse.
the class OverrideAndUpdateSynchronizeOperation method getIncoming.
private IResource[] getIncoming(IResource[] resources) throws TeamException {
List<IResource> incomingResources = new ArrayList<IResource>();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
SVNStatusSyncInfo info = (SVNStatusSyncInfo) SVNWorkspaceSubscriber.getInstance().getSyncInfo(resource);
if (info != null) {
if (SyncInfo.getDirection(info.getKind()) == SyncInfo.INCOMING || SyncInfo.getDirection(info.getKind()) == SyncInfo.CONFLICTING)
incomingResources.add(resource);
}
}
IResource[] incomingArray = new IResource[incomingResources.size()];
incomingResources.toArray(incomingArray);
return incomingArray;
}
use of org.tigris.subversion.subclipse.core.sync.SVNStatusSyncInfo in project subclipse by subclipse.
the class SVNChangeSetCollector method add.
/*
* (non-Javadoc)
* @see org.eclipse.team.internal.ui.synchronize.SyncInfoSetChangeSetCollector#add(org.eclipse.team.core.synchronize.SyncInfo[])
*/
protected void add(final SyncInfo[] infos) {
final Map sets = new HashMap();
Job job = new Job(Policy.bind("SynchronizeView.collectingChangeSets")) {
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(null, infos.length);
for (int i = 0; i < infos.length; i++) {
SyncInfo syncInfo = infos[i];
if (syncInfo instanceof SVNStatusSyncInfo) {
SVNStatusSyncInfo svnSyncInfo = (SVNStatusSyncInfo) syncInfo;
if (SyncInfo.getDirection(svnSyncInfo.getKind()) == SyncInfo.INCOMING && svnSyncInfo.getRemote() != null) {
SVNCheckedInChangeSet changeSet = (SVNCheckedInChangeSet) sets.get(svnSyncInfo.getRemote().getContentIdentifier());
if (changeSet == null) {
changeSet = new SVNCheckedInChangeSet(svnSyncInfo);
sets.put(svnSyncInfo.getRemote().getContentIdentifier(), changeSet);
} else {
changeSet.add(svnSyncInfo);
}
}
}
monitor.worked(1);
}
monitor.done();
performUpdate(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
for (Iterator it = sets.values().iterator(); it.hasNext(); ) {
SVNCheckedInChangeSet set = (SVNCheckedInChangeSet) it.next();
SVNChangeSetCollector.this.add(set);
}
}
}, true, new NullProgressMonitor());
return Status.OK_STATUS;
}
};
job.schedule();
try {
job.join();
} catch (InterruptedException ex) {
//
}
}
use of org.tigris.subversion.subclipse.core.sync.SVNStatusSyncInfo in project subclipse by subclipse.
the class SubclipseLinkedTaskInfo method getText.
public String getText() {
if (comment == null && changeSet != null) {
try {
SyncInfoTree syncInfoSet = changeSet.getSyncInfoSet();
SVNStatusSyncInfo info = (SVNStatusSyncInfo) syncInfoSet.getSyncInfo(resource);
ISVNRemoteResource remoteResource = (ISVNRemoteResource) info.getRemote();
SVNRevision rev = remoteResource.getLastChangedRevision();
ISVNLogMessage[] messages = remoteResource.getLogMessages(rev, rev, SVNRevision.START, false, false, 1, false);
comment = messages[0].getMessage();
} catch (TeamException ex) {
comment = changeSet.getComment();
}
}
return comment;
}
Aggregations