private CheckedInChangeSet getChangeSetFor(ILogEntry logEntry) { ChangeSet[] sets = getSets(); for (int i = 0; i < sets.length; i++) { ChangeSet set = sets[i]; if (set instanceof CheckedInChangeSet && set.getComment().equals(logEntry.getComment()) && ((CheckedInChangeSet) set).getAuthor().equals(logEntry.getAuthor())) { return (CheckedInChangeSet) set; } } return null; }
public CVSCheckedInChangeSet(ILogEntry entry) { this.entry = entry; Date date = entry.getDate(); String comment = Util.flattenText(entry.getComment()); if (date == null) { setName("[" + entry.getAuthor() + "] " + comment); // $NON-NLS-1$ //$NON-NLS-2$ } else { String dateString = DateFormat.getDateTimeInstance().format(date); setName( "[" + entry.getAuthor() + "] (" + dateString + ") " + comment); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } }
private boolean requiresCustomSyncInfo( SyncInfo info, ICVSRemoteResource remoteResource, ILogEntry logEntry) { // Only interested in non-deletions if (logEntry.isDeletion() || !(info instanceof CVSSyncInfo)) return false; // Only require a custom sync info if the remote of the sync info // differs from the remote in the log entry IResourceVariant remote = info.getRemote(); if (remote == null) return true; return !remote.equals(remoteResource); }
/* * Add a single log entry to the model. * * @param info * @param logs * @param remoteResource */ private void addSingleRevision( SyncInfo info, LogEntryCache logs, ICVSRemoteResource remoteResource) { ILogEntry logEntry = logs.getLogEntry(remoteResource); if (remoteResource != null && !remoteResource.isFolder()) { // For incoming deletions grab the comment for the latest on the same branch // which is now in the attic. try { String remoteRevision = ((ICVSRemoteFile) remoteResource).getRevision(); if (isDeletedRemotely(info)) { ILogEntry[] logEntries = logs.getLogEntries(remoteResource); for (int i = 0; i < logEntries.length; i++) { ILogEntry entry = logEntries[i]; String revision = entry.getRevision(); if (entry.isDeletion() && ResourceSyncInfo.isLaterRevision(revision, remoteRevision)) { logEntry = entry; } } } } catch (TeamException e) { // continue and skip deletion checks } } addRemoteChange(info, remoteResource, logEntry); }
/* * Add the remote change to an incoming commit set */ private void addRemoteChange( SyncInfo info, ICVSRemoteResource remoteResource, ILogEntry logEntry) { if (disposed) return; LogEntryCacheUpdateHandler handler = getLogEntryHandler(); if (handler != null && remoteResource != null && logEntry != null && handler.isRemoteChange(info)) { if (requiresCustomSyncInfo(info, remoteResource, logEntry)) { info = new CVSUpdatableSyncInfo( info.getKind(), info.getLocal(), info.getBase(), (RemoteResource) logEntry.getRemoteFile(), ((CVSSyncInfo) info).getSubscriber()); try { info.init(); } catch (TeamException e) { // this shouldn't happen, we've provided our own calculate kind } } // Only add the info if the base and remote differ IResourceVariant base = info.getBase(); IResourceVariant remote = info.getRemote(); if ((base == null && remote != null) || (remote == null && base != null) || (remote != null && base != null && !base.equals(remote))) { synchronized (this) { CheckedInChangeSet set = getChangeSetFor(logEntry); if (set == null) { set = createChangeSetFor(logEntry); add(set); } set.add(info); } } } else { // The info was not retrieved for the remote change for some reason. // Add the node to the root addToDefaultSet(DEFAULT_INCOMING_SET_NAME, info); } }
/* (non-Javadoc) * @see org.eclipse.team.core.subscribers.ChangeSet#getComment() */ public String getComment() { return entry.getComment(); }
/* (non-Javadoc) * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getDate() */ public Date getDate() { return entry.getDate(); }
/* (non-Javadoc) * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getAuthor() */ public String getAuthor() { return entry.getAuthor(); }