Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2006-01-26 14:00:22 +0000
committerMichael Valenta2006-01-26 14:00:22 +0000
commit306a4be39e184c316086c2220047d2ecaeee1e8c (patch)
tree5d9bfaec84e5907822941f82daecc07b74d7f1a1
parentc5fe2de56105e9c75175419748b333f4576f006a (diff)
downloadeclipse.platform.team-306a4be39e184c316086c2220047d2ecaeee1e8c.tar.gz
eclipse.platform.team-306a4be39e184c316086c2220047d2ecaeee1e8c.tar.xz
eclipse.platform.team-306a4be39e184c316086c2220047d2ecaeee1e8c.zip
Minor changes to the file history API to support queries on a single line of descent
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistory.java24
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistoryProvider.java18
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java9
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistoryProvider.java2
4 files changed, 34 insertions, 19 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistory.java
index 6ce363ffb..261f63618 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistory.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistory.java
@@ -49,21 +49,27 @@ public interface IFileHistory {
public abstract IFileRevision getFileRevision(String id);
/**
- * Returns the previous version of the passed in file revision.
- * @param revision the current revision
- * @return the previous version of the passed in revision or null if the revision had no
- * predecessor
+ * Returns the direct predecessors of the given revision.
+ * If the file revision was the result of a single modification,
+ * then only a single predecessor will be returned. However,
+ * if the revision was the result of a merge of multiple
+ * revisions, then all revisions that were merge may be returned
+ * depending on whether the history provider tracks merges.
+ * @param revision a file revision revision
+ * @return the direct predecessors of the given file revision or
+ * an empty array if there are no predecessors
*/
- public abstract IFileRevision getPredecessor(IFileRevision revision);
+ public abstract IFileRevision[] getContributors(IFileRevision revision);
/**
- * Returns all of the direct descendents of the passed in file revision.
+ * Returns all of the direct descendents of the given in file revision.
+ * Multiple revisions may be returned if the given revision is a branch
+ * point or was merged into another revision. Some history providers may not
+ * track branches or merges, in which case a singel descendant may be returned.
*
* @param revision the file revision that acts as the root
* @return an array containing all of the the descendents or an empty array if the revision has
* no direct descendents
*/
- public abstract IFileRevision[] getDirectDescendents(IFileRevision revision);
-
- //TODO: Methods for getting all direct children of file revision, all elements along a branch (predecessors, file revision and descendent)
+ public abstract IFileRevision[] getTargets(IFileRevision revision);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistoryProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistoryProvider.java
index 680847d00..c316083c5 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistoryProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/IFileHistoryProvider.java
@@ -33,20 +33,28 @@ import org.eclipse.team.core.history.provider.FileHistoryProvider;
public interface IFileHistoryProvider {
/**
- * Returns the file history for the passed in resource
+ * Returns the file history for the given in resource.
+ * If <code>singleLine</code> is <code>true</code> then the
+ * resulting history will be restricted to a single line-of-descent
+ * (e.g. a single branch). In this mode, the
+ * {@link IFileHistory#getContributors(IFileRevision)} and
+ * {@link IFileHistory#getTargets(IFileRevision)} should either
+ * return zero or one revision.
*
- * @param resource
- * @param monitor
+ *
+ * @param resource the resource
+ * @param singleLine whether the returned history should be restricted to a single line of descent
+ * @param monitor a progress monitor
* @return the history of the file
*/
- public abstract IFileHistory getFileHistoryFor(IResource resource, IProgressMonitor monitor);
+ public abstract IFileHistory getFileHistoryFor(IResource resource, boolean singleLine, IProgressMonitor monitor);
/**
* Returns the file revision of the passed in resourrce or null if that file revision cannot be
* determined
*
- * @param resource
+ * @param resource the resource
* @return the file revision belonging to the passed in resource or null
*/
public abstract IFileRevision getWorkspaceFileRevision(IResource resource);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java
index 3dfbaac04..0511867c1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistory.java
@@ -79,7 +79,7 @@ public class CVSFileHistory extends FileHistory {
return null;
}
- public IFileRevision getPredecessor(IFileRevision revision) {
+ public IFileRevision[] getContributors(IFileRevision revision) {
IFileRevision[] revisions = getFileRevisions();
@@ -98,13 +98,14 @@ public class CVSFileHistory extends FileHistory {
}
}
}
-
- return fileRevision;
+ if (fileRevision == null)
+ return new IFileRevision[0];
+ return new IFileRevision[] { fileRevision };
}
- public IFileRevision[] getDirectDescendents(IFileRevision revision) {
+ public IFileRevision[] getTargets(IFileRevision revision) {
IFileRevision[] revisions = getFileRevisions();
//the predecessor is the file with a timestamp that is the largest timestamp
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistoryProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistoryProvider.java
index 9e8dbb6d5..dd1a46612 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistoryProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filehistory/CVSFileHistoryProvider.java
@@ -30,7 +30,7 @@ public class CVSFileHistoryProvider extends FileHistoryProvider {
/**
* see <code>org.eclipse.team.core.IFileHistoryProvider</code>
*/
- public IFileHistory getFileHistoryFor(IResource resource, IProgressMonitor monitor){
+ public IFileHistory getFileHistoryFor(IResource resource, boolean singleLine, IProgressMonitor monitor){
ICVSRemoteResource remoteResource;
try {
monitor.beginTask(null, 100);

Back to the top