git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 03/12] Change RevWalkTestCase to use RevCommit, not ObjectId
Date: Tue, 17 Mar 2009 18:40:42 -0700	[thread overview]
Message-ID: <1237340451-31562-4-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1237340451-31562-3-git-send-email-spearce@spearce.org>

We build a RevWalk once per test, and only execute a single traversal
in that test run.  Its more clear to use the RevCommit type from that
object pool to represent a commit entity than the generic ObjectId.

When creating a new commit we allocate its RevCommit from the pool,
but we delay parsing until as late as necessary.  This is needed for
at least one test where it validates whether or not the parents of a
commit were allocated after traversal finishes.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../org/spearce/jgit/revwalk/RevWalkCullTest.java  |   28 +++---
 .../spearce/jgit/revwalk/RevWalkFilterTest.java    |   91 ++++++++++----------
 .../spearce/jgit/revwalk/RevWalkMergeBaseTest.java |   45 +++++-----
 .../org/spearce/jgit/revwalk/RevWalkSortTest.java  |   64 +++++++-------
 .../org/spearce/jgit/revwalk/RevWalkTestCase.java  |   30 +++---
 5 files changed, 126 insertions(+), 132 deletions(-)

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
index e734273..2f61598 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
@@ -37,8 +37,6 @@
 
 package org.spearce.jgit.revwalk;
 
-import org.spearce.jgit.lib.ObjectId;
-
 public class RevWalkCullTest extends RevWalkTestCase {
 	public void testProperlyCullAllAncestors1() throws Exception {
 		// Credit goes to Junio C Hamano <gitster@pobox.com> for this
@@ -46,10 +44,10 @@ public void testProperlyCullAllAncestors1() throws Exception {
 		//
 		// We induce a clock skew so two is dated before one.
 		//
-		final ObjectId a = commit();
-		final ObjectId b = commit(-2400, a);
-		final ObjectId c = commit(b);
-		final ObjectId d = commit(c);
+		final RevCommit a = commit();
+		final RevCommit b = commit(-2400, a);
+		final RevCommit c = commit(b);
+		final RevCommit d = commit(c);
 
 		markStart(a);
 		markUninteresting(d);
@@ -60,11 +58,11 @@ public void testProperlyCullAllAncestors2() throws Exception {
 		// Despite clock skew on c1 being very old it should not
 		// produce, neither should a or b, or any part of that chain.
 		//
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c1 = commit(-5, b);
-		final ObjectId c2 = commit(10, b);
-		final ObjectId d = commit(c1, c2);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c1 = commit(-5, b);
+		final RevCommit c2 = commit(10, b);
+		final RevCommit d = commit(c1, c2);
 
 		markStart(d);
 		markUninteresting(c1);
@@ -74,14 +72,14 @@ public void testProperlyCullAllAncestors2() throws Exception {
 	}
 
 	public void testProperlyCullAllAncestors_LongHistory() throws Exception {
-		final ObjectId a = commit();
-		ObjectId b = commit(a);
+		final RevCommit a = commit();
+		RevCommit b = commit(a);
 		for (int i = 0; i < 24; i++) {
 			b = commit(b);
 			if ((i & 2) == 0)
 				markUninteresting(b);
 		}
-		final ObjectId c = commit(b);
+		final RevCommit c = commit(b);
 
 		markStart(c);
 		markUninteresting(b);
@@ -91,6 +89,6 @@ public void testProperlyCullAllAncestors_LongHistory() throws Exception {
 		// We should have aborted before we got back so far that "a"
 		// would be parsed. Thus, its parents shouldn't be allocated.
 		//
-		assertNull(rw.lookupCommit(a).parents);
+		assertNull(a.parents);
 	}
 }
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
index d079bdc..6a26d2e 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
@@ -42,7 +42,6 @@
 import org.spearce.jgit.errors.IncorrectObjectTypeException;
 import org.spearce.jgit.errors.MissingObjectException;
 import org.spearce.jgit.errors.StopWalkException;
-import org.spearce.jgit.lib.ObjectId;
 import org.spearce.jgit.revwalk.filter.AndRevFilter;
 import org.spearce.jgit.revwalk.filter.NotRevFilter;
 import org.spearce.jgit.revwalk.filter.OrRevFilter;
@@ -52,9 +51,9 @@
 	private static final MyAll MY_ALL = new MyAll();
 
 	public void testFilter_ALL() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(RevFilter.ALL);
 		markStart(c);
@@ -65,9 +64,9 @@ public void testFilter_ALL() throws Exception {
 	}
 
 	public void testFilter_Negate_ALL() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(RevFilter.ALL.negate());
 		markStart(c);
@@ -75,9 +74,9 @@ public void testFilter_Negate_ALL() throws Exception {
 	}
 
 	public void testFilter_NOT_ALL() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(NotRevFilter.create(RevFilter.ALL));
 		markStart(c);
@@ -85,9 +84,9 @@ public void testFilter_NOT_ALL() throws Exception {
 	}
 
 	public void testFilter_NONE() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(RevFilter.NONE);
 		markStart(c);
@@ -95,9 +94,9 @@ public void testFilter_NONE() throws Exception {
 	}
 
 	public void testFilter_NOT_NONE() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(NotRevFilter.create(RevFilter.NONE));
 		markStart(c);
@@ -108,9 +107,9 @@ public void testFilter_NOT_NONE() throws Exception {
 	}
 
 	public void testFilter_ALL_And_NONE() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(AndRevFilter.create(RevFilter.ALL, RevFilter.NONE));
 		markStart(c);
@@ -118,9 +117,9 @@ public void testFilter_ALL_And_NONE() throws Exception {
 	}
 
 	public void testFilter_NONE_And_ALL() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(AndRevFilter.create(RevFilter.NONE, RevFilter.ALL));
 		markStart(c);
@@ -128,9 +127,9 @@ public void testFilter_NONE_And_ALL() throws Exception {
 	}
 
 	public void testFilter_ALL_Or_NONE() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(OrRevFilter.create(RevFilter.ALL, RevFilter.NONE));
 		markStart(c);
@@ -141,9 +140,9 @@ public void testFilter_ALL_Or_NONE() throws Exception {
 	}
 
 	public void testFilter_NONE_Or_ALL() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(OrRevFilter.create(RevFilter.NONE, RevFilter.ALL));
 		markStart(c);
@@ -154,9 +153,9 @@ public void testFilter_NONE_Or_ALL() throws Exception {
 	}
 
 	public void testFilter_MY_ALL_And_NONE() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(AndRevFilter.create(MY_ALL, RevFilter.NONE));
 		markStart(c);
@@ -164,9 +163,9 @@ public void testFilter_MY_ALL_And_NONE() throws Exception {
 	}
 
 	public void testFilter_NONE_And_MY_ALL() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(AndRevFilter.create(RevFilter.NONE, MY_ALL));
 		markStart(c);
@@ -174,9 +173,9 @@ public void testFilter_NONE_And_MY_ALL() throws Exception {
 	}
 
 	public void testFilter_MY_ALL_Or_NONE() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(OrRevFilter.create(MY_ALL, RevFilter.NONE));
 		markStart(c);
@@ -187,9 +186,9 @@ public void testFilter_MY_ALL_Or_NONE() throws Exception {
 	}
 
 	public void testFilter_NONE_Or_MY_ALL() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
 
 		rw.setRevFilter(OrRevFilter.create(RevFilter.NONE, MY_ALL));
 		markStart(c);
@@ -200,12 +199,12 @@ public void testFilter_NONE_Or_MY_ALL() throws Exception {
 	}
 
 	public void testFilter_NO_MERGES() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c1 = commit(b);
-		final ObjectId c2 = commit(b);
-		final ObjectId d = commit(c1, c2);
-		final ObjectId e = commit(d);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c1 = commit(b);
+		final RevCommit c2 = commit(b);
+		final RevCommit d = commit(c1, c2);
+		final RevCommit e = commit(d);
 
 		rw.setRevFilter(RevFilter.NO_MERGES);
 		markStart(e);
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
index cec4e3f..fc1a37c 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
@@ -37,13 +37,12 @@
 
 package org.spearce.jgit.revwalk;
 
-import org.spearce.jgit.lib.ObjectId;
 import org.spearce.jgit.revwalk.filter.RevFilter;
 
 public class RevWalkMergeBaseTest extends RevWalkTestCase {
 	public void testNone() throws Exception {
-		final ObjectId c1 = commit(commit(commit()));
-		final ObjectId c2 = commit(commit(commit()));
+		final RevCommit c1 = commit(commit(commit()));
+		final RevCommit c2 = commit(commit(commit()));
 
 		rw.setRevFilter(RevFilter.MERGE_BASE);
 		markStart(c1);
@@ -52,10 +51,10 @@ public void testNone() throws Exception {
 	}
 
 	public void testSimple() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c1 = commit(commit(commit(commit(commit(b)))));
-		final ObjectId c2 = commit(commit(commit(commit(commit(b)))));
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c1 = commit(commit(commit(commit(commit(b)))));
+		final RevCommit c2 = commit(commit(commit(commit(commit(b)))));
 
 		rw.setRevFilter(RevFilter.MERGE_BASE);
 		markStart(c1);
@@ -65,11 +64,11 @@ public void testSimple() throws Exception {
 	}
 
 	public void testMultipleHeads_SameBase1() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c1 = commit(commit(commit(commit(commit(b)))));
-		final ObjectId c2 = commit(commit(commit(commit(commit(b)))));
-		final ObjectId c3 = commit(commit(commit(b)));
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c1 = commit(commit(commit(commit(commit(b)))));
+		final RevCommit c2 = commit(commit(commit(commit(commit(b)))));
+		final RevCommit c3 = commit(commit(commit(b)));
 
 		rw.setRevFilter(RevFilter.MERGE_BASE);
 		markStart(c1);
@@ -80,12 +79,12 @@ public void testMultipleHeads_SameBase1() throws Exception {
 	}
 
 	public void testMultipleHeads_SameBase2() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
-		final ObjectId d1 = commit(commit(commit(commit(commit(b)))));
-		final ObjectId d2 = commit(commit(commit(commit(commit(c)))));
-		final ObjectId d3 = commit(commit(commit(c)));
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
+		final RevCommit d1 = commit(commit(commit(commit(commit(b)))));
+		final RevCommit d2 = commit(commit(commit(commit(commit(c)))));
+		final RevCommit d3 = commit(commit(commit(c)));
 
 		rw.setRevFilter(RevFilter.MERGE_BASE);
 		markStart(d1);
@@ -101,11 +100,11 @@ public void testCrissCross() throws Exception {
 		// clean merge base for d,e as they each merged the parents b,c
 		// in different orders.
 		//
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(a);
-		final ObjectId d = commit(b, c);
-		final ObjectId e = commit(c, b);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(a);
+		final RevCommit d = commit(b, c);
+		final RevCommit e = commit(c, b);
 
 		rw.setRevFilter(RevFilter.MERGE_BASE);
 		markStart(d);
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
index 3ed1565..7435197 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
@@ -37,14 +37,12 @@
 
 package org.spearce.jgit.revwalk;
 
-import org.spearce.jgit.lib.ObjectId;
-
 public class RevWalkSortTest extends RevWalkTestCase {
 	public void testSort_Default() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(1, a);
-		final ObjectId c = commit(1, b);
-		final ObjectId d = commit(1, c);
+		final RevCommit a = commit();
+		final RevCommit b = commit(1, a);
+		final RevCommit c = commit(1, b);
+		final RevCommit d = commit(1, c);
 
 		markStart(d);
 		assertCommit(d, rw.next());
@@ -55,10 +53,10 @@ public void testSort_Default() throws Exception {
 	}
 
 	public void testSort_COMMIT_TIME_DESC() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
-		final ObjectId d = commit(c);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
+		final RevCommit d = commit(c);
 
 		rw.sort(RevSort.COMMIT_TIME_DESC);
 		markStart(d);
@@ -70,10 +68,10 @@ public void testSort_COMMIT_TIME_DESC() throws Exception {
 	}
 
 	public void testSort_REVERSE() throws Exception {
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(b);
-		final ObjectId d = commit(c);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(b);
+		final RevCommit d = commit(c);
 
 		rw.sort(RevSort.REVERSE);
 		markStart(d);
@@ -88,10 +86,10 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder1() throws Exception {
 		// Despite being out of order time-wise, a strand-of-pearls must
 		// still maintain topological order.
 		//
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c = commit(-5, b);
-		final ObjectId d = commit(10, c);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c = commit(-5, b);
+		final RevCommit d = commit(10, c);
 		assertTrue(parse(a).getCommitTime() < parse(d).getCommitTime());
 		assertTrue(parse(c).getCommitTime() < parse(b).getCommitTime());
 
@@ -107,11 +105,11 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder1() throws Exception {
 	public void testSort_COMMIT_TIME_DESC_OutOfOrder2() throws Exception {
 		// c1 is back dated before its parent.
 		//
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c1 = commit(-5, b);
-		final ObjectId c2 = commit(10, b);
-		final ObjectId d = commit(c1, c2);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c1 = commit(-5, b);
+		final RevCommit c2 = commit(10, b);
+		final RevCommit d = commit(c1, c2);
 
 		rw.sort(RevSort.COMMIT_TIME_DESC);
 		markStart(d);
@@ -126,11 +124,11 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder2() throws Exception {
 	public void testSort_TOPO() throws Exception {
 		// c1 is back dated before its parent.
 		//
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c1 = commit(-5, b);
-		final ObjectId c2 = commit(10, b);
-		final ObjectId d = commit(c1, c2);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c1 = commit(-5, b);
+		final RevCommit c2 = commit(10, b);
+		final RevCommit d = commit(c1, c2);
 
 		rw.sort(RevSort.TOPO);
 		markStart(d);
@@ -145,11 +143,11 @@ public void testSort_TOPO() throws Exception {
 	public void testSort_TOPO_REVERSE() throws Exception {
 		// c1 is back dated before its parent.
 		//
-		final ObjectId a = commit();
-		final ObjectId b = commit(a);
-		final ObjectId c1 = commit(-5, b);
-		final ObjectId c2 = commit(10, b);
-		final ObjectId d = commit(c1, c2);
+		final RevCommit a = commit();
+		final RevCommit b = commit(a);
+		final RevCommit c1 = commit(-5, b);
+		final RevCommit c2 = commit(10, b);
+		final RevCommit d = commit(c1, c2);
 
 		rw.sort(RevSort.TOPO);
 		rw.sort(RevSort.REVERSE, true);
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
index a477be9..f83be8d 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
@@ -40,7 +40,6 @@
 import java.util.Date;
 
 import org.spearce.jgit.lib.Commit;
-import org.spearce.jgit.lib.ObjectId;
 import org.spearce.jgit.lib.ObjectWriter;
 import org.spearce.jgit.lib.PersonIdent;
 import org.spearce.jgit.lib.RepositoryTestCase;
@@ -50,7 +49,7 @@
 public abstract class RevWalkTestCase extends RepositoryTestCase {
 	protected ObjectWriter ow;
 
-	protected ObjectId emptyTree;
+	protected RevTree emptyTree;
 
 	protected long nowTick;
 
@@ -59,20 +58,20 @@
 	public void setUp() throws Exception {
 		super.setUp();
 		ow = new ObjectWriter(db);
-		emptyTree = ow.writeTree(new Tree(db));
-		nowTick = 1236977987000L;
 		rw = new RevWalk(db);
+		emptyTree = rw.parseTree(ow.writeTree(new Tree(db)));
+		nowTick = 1236977987000L;
 	}
 
 	protected void tick(final int secDelta) {
 		nowTick += secDelta * 1000L;
 	}
 
-	protected ObjectId commit(final ObjectId... parents) throws Exception {
+	protected RevCommit commit(final RevCommit... parents) throws Exception {
 		return commit(1, parents);
 	}
 
-	protected ObjectId commit(final int secDelta, final ObjectId... parents)
+	protected RevCommit commit(final int secDelta, final RevCommit... parents)
 			throws Exception {
 		tick(secDelta);
 		final Commit c = new Commit(db);
@@ -81,22 +80,23 @@ protected ObjectId commit(final int secDelta, final ObjectId... parents)
 		c.setAuthor(new PersonIdent(jauthor, new Date(nowTick)));
 		c.setCommitter(new PersonIdent(jcommitter, new Date(nowTick)));
 		c.setMessage("");
-		return ow.writeCommit(c);
+		return rw.lookupCommit(ow.writeCommit(c));
 	}
 
-	protected RevCommit parse(final ObjectId commitId) throws Exception {
-		return rw.parseCommit(commitId);
+	protected <T extends RevObject> T parse(final T t) throws Exception {
+		rw.parse(t);
+		return t;
 	}
 
-	protected void markStart(final ObjectId commitId) throws Exception {
-		rw.markStart(parse(commitId));
+	protected void markStart(final RevCommit commit) throws Exception {
+		rw.markStart(commit);
 	}
 
-	protected void markUninteresting(final ObjectId commitId) throws Exception {
-		rw.markUninteresting(parse(commitId));
+	protected void markUninteresting(final RevCommit commit) throws Exception {
+		rw.markUninteresting(commit);
 	}
 
-	protected void assertCommit(final ObjectId commitId, final RevCommit commit) {
-		assertEquals(commitId.name(), commit != null ? commit.name() : null);
+	protected void assertCommit(final RevCommit exp, final RevCommit act) {
+		assertSame(exp, act);
 	}
 }
-- 
1.6.2.1.286.g8173

  reply	other threads:[~2009-03-18  1:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18  1:40 [JGIT PATCH 00/12] Improve test coverage in revwalk Shawn O. Pearce
2009-03-18  1:40 ` [JGIT PATCH 01/12] Fix copyright year in revwalk test file headers Shawn O. Pearce
2009-03-18  1:40   ` [JGIT PATCH 02/12] Mark non-overridable methods of RevObject final Shawn O. Pearce
2009-03-18  1:40     ` Shawn O. Pearce [this message]
2009-03-18  1:40       ` [JGIT PATCH 04/12] Test that RevFilter.MERGE_BASE cannot use a TreeFilter Shawn O. Pearce
2009-03-18  1:40         ` [JGIT PATCH 05/12] Add unit tests for DateRevQueue Shawn O. Pearce
2009-03-18  1:40           ` [JGIT PATCH 06/12] Add unit tests for FIFORevQueue Shawn O. Pearce
2009-03-18  1:40             ` [JGIT PATCH 07/12] Add unit tests for LIFORevQueue Shawn O. Pearce
2009-03-18  1:40               ` [JGIT PATCH 08/12] Add unit tests for AbstractRevQueue.EMPTY_QUEUE Shawn O. Pearce
2009-03-18  1:40                 ` [JGIT PATCH 09/12] Add tests for basic RevObject methods related to type, flags Shawn O. Pearce
2009-03-18  1:40                   ` [JGIT PATCH 10/12] Add tests for ObjectWalk Shawn O. Pearce
2009-03-18  1:40                     ` [JGIT PATCH 11/12] Add some basic logic tests for TreeFilter on RevWalk Shawn O. Pearce
2009-03-18  1:40                       ` [JGIT PATCH 12/12] Implement git-core t/t6012-rev-list-simplify test case Shawn O. Pearce
2009-03-18  6:34 ` [JGIT PATCH 00/12] Improve test coverage in revwalk Robin Rosenberg
2009-03-18  9:21   ` Robin Rosenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1237340451-31562-4-git-send-email-spearce@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).