Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce2010-08-20 20:28:52 -0400
committerShawn O. Pearce2010-08-20 20:28:52 -0400
commitaa1733a1b61ee86340206b02f5c090eacb8c4a0b (patch)
tree4e2658be47bfe8949e276493d667dd89015761bc /org.eclipse.egit.core.test
parentb193fa793fdca803ef04963a5b09634f39f72d39 (diff)
downloadegit-aa1733a1b61ee86340206b02f5c090eacb8c4a0b.tar.gz
egit-aa1733a1b61ee86340206b02f5c090eacb8c4a0b.tar.xz
egit-aa1733a1b61ee86340206b02f5c090eacb8c4a0b.zip
Replace deprecated Tag, Commit usage with RevTag, RevCommit
JGit is changing its API to no longer make Tag and Commit classes accessible for reading purposes. The only thing they will support is the creation of new objects, and even then their APIs are moving to a simpler and more consistent usage style. Replace relevant uses of tags and commits with their RevWalk based variants, fixing any build breakages caused by this JGit change. Change-Id: I070e309894989024b26be7638bbfcc62a9a4b00d Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.egit.core.test')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/HistoryTest.java10
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java4
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java19
3 files changed, 16 insertions, 17 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/HistoryTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/HistoryTest.java
index f5a08929e..85ea43f9a 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/HistoryTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/internal/mapping/HistoryTest.java
@@ -78,13 +78,13 @@ public class HistoryTest extends GitTestCase {
addFile(projectTree,project1_b_txt);
projectTree.setId(objectWriter.writeTree(projectTree));
tree.setId(objectWriter.writeTree(tree));
- Commit commit = new Commit(thisGit);
+ Commit commit = new Commit();
commit.setAuthor(new PersonIdent(jauthor, new Date(0L), TimeZone
.getTimeZone("GMT+1")));
commit.setCommitter(new PersonIdent(jcommitter, new Date(0L), TimeZone
.getTimeZone("GMT+1")));
commit.setMessage("Foo\n\nMessage");
- commit.setTree(tree);
+ commit.setTreeId(tree.getTreeId());
ObjectId commitId = objectWriter.writeCommit(commit);
tree = new Tree(thisGit);
@@ -95,14 +95,14 @@ public class HistoryTest extends GitTestCase {
addFile(projectTree,project1_b_v2_txt);
projectTree.setId(objectWriter.writeTree(projectTree));
tree.setId(objectWriter.writeTree(tree));
- commit = new Commit(thisGit);
+ commit = new Commit();
commit.setAuthor(new PersonIdent(jauthor, new Date(0L), TimeZone
.getTimeZone("GMT+1")));
commit.setCommitter(new PersonIdent(jcommitter, new Date(0L), TimeZone
.getTimeZone("GMT+1")));
commit.setMessage("Modified");
- commit.setParentIds(new ObjectId[] { commitId });
- commit.setTree(tree);
+ commit.setParentId(commitId);
+ commit.setTreeId(tree.getTreeId());
commitId = objectWriter.writeCommit(commit);
RefUpdate lck = thisGit.updateRef("refs/heads/master");
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
index 42ec2e403..73289a298 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
@@ -84,8 +84,8 @@ public class ConnectProviderOperationTest extends GitTestCase {
srcTree.setId(writer.writeTree(srcTree));
prjTree.setId(writer.writeTree(prjTree));
rootTree.setId(writer.writeTree(rootTree));
- Commit commit = new Commit(thisGit);
- commit.setTree(rootTree);
+ Commit commit = new Commit();
+ commit.setTreeId(rootTree.getTreeId());
commit.setAuthor(new PersonIdent("J. Git", "j.git@egit.org", new Date(
60876075600000L), TimeZone.getTimeZone("GMT+1")));
commit.setCommitter(commit.getAuthor());
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java
index 8a473daec..56efa3984 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/TagOperationTest.java
@@ -31,6 +31,7 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Tag;
+import org.eclipse.jgit.revwalk.RevTag;
import org.eclipse.jgit.revwalk.RevWalk;
import org.junit.After;
import org.junit.Before;
@@ -90,12 +91,12 @@ public class TagOperationTest extends DualRepositoryTestCase {
public void addTag() throws Exception {
assertTrue("Tags should be empty", repository1.getRepository()
.getTags().isEmpty());
- Tag newTag = new Tag(repository1.getRepository());
+ Tag newTag = new Tag();
newTag.setTag("TheNewTag");
newTag.setMessage("Well, I'm the tag");
newTag.setTagger(new PersonIdent(TestUtils.AUTHOR));
- newTag.setObjId(repository1.getRepository()
- .resolve("refs/heads/master"));
+ newTag.setObjectId(repository1.getRepository()
+ .resolve("refs/heads/master"), Constants.OBJ_COMMIT);
TagOperation top = new TagOperation(repository1.getRepository(),
newTag, false);
top.execute(new NullProgressMonitor());
@@ -118,18 +119,16 @@ public class TagOperationTest extends DualRepositoryTestCase {
}
Ref tagRef = repository1.getRepository().getTags().get("TheNewTag");
RevWalk walk = new RevWalk(repository1.getRepository());
- Tag tag = walk.parseTag(
- repository1.getRepository().resolve(tagRef.getName())).asTag(
- walk);
+ RevTag tag = walk.parseTag(
+ repository1.getRepository().resolve(tagRef.getName()));
newTag.setMessage("Another message");
- assertFalse("Messages should differ", tag.getMessage().equals(
+ assertFalse("Messages should differ", tag.getFullMessage().equals(
newTag.getMessage()));
top.execute(null);
tag = walk.parseTag(
- repository1.getRepository().resolve(tagRef.getName())).asTag(
- walk);
- assertTrue("Messages be same", tag.getMessage().equals(
+ repository1.getRepository().resolve(tagRef.getName()));
+ assertTrue("Messages be same", tag.getFullMessage().equals(
newTag.getMessage()));
}

Back to the top