{"thread":{"id":"18364","subject":"[JGIT PATCH 00/12] Improve test coverage in revwalk","startedAt":"2009-03-18T01:40:39Z","lastAt":"2009-03-18T09:21:52Z","messageCount":15,"participants":["Shawn O. Pearce","Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":12},"messages":[{"id":"108309","messageId":"1237340451-31562-1-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":null,"subject":"[JGIT PATCH 00/12] Improve test coverage in revwalk","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:39Z","receivedAt":"2009-03-18T01:40:39Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Most of these patches are to improve the test coverage within the\nrevwalk package.\n\n\nThe last commit points out what I feared, which is that a RevWalk\nwith a PathFilter applied doesn't produce the same results that\ngit-core would produce in the same situation.  We're either missing\nsome functions necessary to implement it, or we flat out produce\na wrong graph in some cases.\n\nThe tests are commented out because JUnit doesn't have a notion of\n\"known broken\".  But I did leave in TODO comments.  I'd like to\napply the test, and then work later to improve it, but I'm open\nto suggestions.\n\n\nShawn O. Pearce (12):\n  Fix copyright year in revwalk test file headers\n  Mark non-overridable methods of RevObject final\n  Change RevWalkTestCase to use RevCommit, not ObjectId\n  Test that RevFilter.MERGE_BASE cannot use a TreeFilter\n  Add unit tests for DateRevQueue\n  Add unit tests for FIFORevQueue\n  Add unit tests for LIFORevQueue\n  Add unit tests for AbstractRevQueue.EMPTY_QUEUE\n  Add tests for basic RevObject methods related to type, flags\n  Add tests for ObjectWalk\n  Add some basic logic tests for TreeFilter on RevWalk\n  Implement git-core t/t6012-rev-list-simplify test case\n\n .../jgit/revwalk/AlwaysEmptyRevQueueTest.java      |   63 +++++++\n .../org/spearce/jgit/revwalk/DateRevQueueTest.java |  118 ++++++++++++\n .../org/spearce/jgit/revwalk/FIFORevQueueTest.java |   81 +++++++++\n .../org/spearce/jgit/revwalk/LIFORevQueueTest.java |   69 +++++++\n .../org/spearce/jgit/revwalk/ObjectWalkTest.java   |  190 ++++++++++++++++++++\n .../org/spearce/jgit/revwalk/RevFlagSetTest.java   |    2 +-\n .../org/spearce/jgit/revwalk/RevObjectTest.java    |  171 ++++++++++++++++++\n .../org/spearce/jgit/revwalk/RevQueueTestCase.java |   85 +++++++++\n .../org/spearce/jgit/revwalk/RevWalkCullTest.java  |   30 ++--\n .../spearce/jgit/revwalk/RevWalkFilterTest.java    |   93 +++++-----\n .../spearce/jgit/revwalk/RevWalkMergeBaseTest.java |   64 ++++---\n .../jgit/revwalk/RevWalkPathFilter1Test.java       |  176 ++++++++++++++++++\n .../jgit/revwalk/RevWalkPathFilter6012Test.java    |  162 +++++++++++++++++\n .../org/spearce/jgit/revwalk/RevWalkSortTest.java  |   66 ++++----\n .../org/spearce/jgit/revwalk/RevWalkTestCase.java  |  110 ++++++++++--\n .../org/spearce/jgit/revwalk/AbstractRevQueue.java |    2 +-\n .../org/spearce/jgit/revwalk/BlockRevQueue.java    |    2 +-\n .../src/org/spearce/jgit/revwalk/RevObject.java    |   20 +-\n 18 files changed, 1353 insertions(+), 151 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java\n"},{"id":"108310","messageId":"1237340451-31562-2-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-1-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 01/12] Fix copyright year in revwalk test file headers","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:40Z","receivedAt":"2009-03-18T01:40:40Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"These were all created in 2009, not 2008.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../org/spearce/jgit/revwalk/RevFlagSetTest.java   |    2 +-\n .../org/spearce/jgit/revwalk/RevWalkCullTest.java  |    2 +-\n .../spearce/jgit/revwalk/RevWalkFilterTest.java    |    2 +-\n .../spearce/jgit/revwalk/RevWalkMergeBaseTest.java |    2 +-\n .../org/spearce/jgit/revwalk/RevWalkSortTest.java  |    2 +-\n .../org/spearce/jgit/revwalk/RevWalkTestCase.java  |    2 +-\n 6 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevFlagSetTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevFlagSetTest.java\nindex 76f3cbb..ff02d64 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevFlagSetTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevFlagSetTest.java\n@@ -1,5 +1,5 @@\n /*\n- * Copyright (C) 2008, Google Inc.\n+ * Copyright (C) 2009, Google Inc.\n  *\n  * All rights reserved.\n  *\ndiff --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\nindex 93bd645..e734273 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java\n@@ -1,5 +1,5 @@\n /*\n- * Copyright (C) 2008, Google Inc.\n+ * Copyright (C) 2009, Google Inc.\n  *\n  * All rights reserved.\n  *\ndiff --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\nindex cf2975d..d079bdc 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java\n@@ -1,5 +1,5 @@\n /*\n- * Copyright (C) 2008, Google Inc.\n+ * Copyright (C) 2009, Google Inc.\n  *\n  * All rights reserved.\n  *\ndiff --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\nindex b05e774..cec4e3f 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java\n@@ -1,5 +1,5 @@\n /*\n- * Copyright (C) 2008, Google Inc.\n+ * Copyright (C) 2009, Google Inc.\n  *\n  * All rights reserved.\n  *\ndiff --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\nindex 6f2eedc..3ed1565 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java\n@@ -1,5 +1,5 @@\n /*\n- * Copyright (C) 2008, Google Inc.\n+ * Copyright (C) 2009, Google Inc.\n  *\n  * All rights reserved.\n  *\ndiff --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\nindex bd696dd..a477be9 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java\n@@ -1,5 +1,5 @@\n /*\n- * Copyright (C) 2008, Google Inc.\n+ * Copyright (C) 2009, Google Inc.\n  *\n  * All rights reserved.\n  *\n-- \n1.6.2.1.286.g8173\n"},{"id":"108311","messageId":"1237340451-31562-3-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-2-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 02/12] Mark non-overridable methods of RevObject final","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:41Z","receivedAt":"2009-03-18T01:40:41Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"There isn't a huge benefit to allowing these methods to be overridden,\nand subclasses might actually screw them up given that flags is only\nvisible within our package.  Mark them all final instead.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../src/org/spearce/jgit/revwalk/RevObject.java    |   20 ++++++++++----------\n 1 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java\nindex 8c7cc23..e8fb29f 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java\n@@ -70,17 +70,17 @@ abstract void parse(RevWalk walk) throws MissingObjectException,\n \t * \n \t * @return unique hash of this object.\n \t */\n-\tpublic ObjectId getId() {\n+\tpublic final ObjectId getId() {\n \t\treturn this;\n \t}\n \n \t@Override\n-\tpublic boolean equals(final ObjectId o) {\n+\tpublic final boolean equals(final ObjectId o) {\n \t\treturn this == o;\n \t}\n \n \t@Override\n-\tpublic boolean equals(final Object o) {\n+\tpublic final boolean equals(final Object o) {\n \t\treturn this == o;\n \t}\n \n@@ -91,7 +91,7 @@ public boolean equals(final Object o) {\n \t *            the flag to test.\n \t * @return true if the flag has been added to this object; false if not.\n \t */\n-\tpublic boolean has(final RevFlag flag) {\n+\tpublic final boolean has(final RevFlag flag) {\n \t\treturn (flags & flag.mask) != 0;\n \t}\n \n@@ -103,7 +103,7 @@ public boolean has(final RevFlag flag) {\n \t * @return true if any flag in the set has been added to this object; false\n \t *         if not.\n \t */\n-\tpublic boolean hasAny(final RevFlagSet set) {\n+\tpublic final boolean hasAny(final RevFlagSet set) {\n \t\treturn (flags & set.mask) != 0;\n \t}\n \n@@ -115,7 +115,7 @@ public boolean hasAny(final RevFlagSet set) {\n \t * @return true if all flags of the set have been added to this object;\n \t *         false if some or none have been added.\n \t */\n-\tpublic boolean hasAll(final RevFlagSet set) {\n+\tpublic final boolean hasAll(final RevFlagSet set) {\n \t\treturn (flags & set.mask) == set.mask;\n \t}\n \n@@ -127,7 +127,7 @@ public boolean hasAll(final RevFlagSet set) {\n \t * @param flag\n \t *            the flag to mark on this object, for later testing.\n \t */\n-\tpublic void add(final RevFlag flag) {\n+\tpublic final void add(final RevFlag flag) {\n \t\tflags |= flag.mask;\n \t}\n \n@@ -137,7 +137,7 @@ public void add(final RevFlag flag) {\n \t * @param set\n \t *            the set of flags to mark on this object, for later testing.\n \t */\n-\tpublic void add(final RevFlagSet set) {\n+\tpublic final void add(final RevFlagSet set) {\n \t\tflags |= set.mask;\n \t}\n \n@@ -149,7 +149,7 @@ public void add(final RevFlagSet set) {\n \t * @param flag\n \t *            the flag to remove from this object.\n \t */\n-\tpublic void remove(final RevFlag flag) {\n+\tpublic final void remove(final RevFlag flag) {\n \t\tflags &= ~flag.mask;\n \t}\n \n@@ -159,7 +159,7 @@ public void remove(final RevFlag flag) {\n \t * @param set\n \t *            the flag to remove from this object.\n \t */\n-\tpublic void remove(final RevFlagSet set) {\n+\tpublic final void remove(final RevFlagSet set) {\n \t\tflags &= ~set.mask;\n \t}\n \n-- \n1.6.2.1.286.g8173\n"},{"id":"108312","messageId":"1237340451-31562-4-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-3-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 03/12] Change RevWalkTestCase to use RevCommit, not ObjectId","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:42Z","receivedAt":"2009-03-18T01:40:42Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"We build a RevWalk once per test, and only execute a single traversal\nin that test run.  Its more clear to use the RevCommit type from that\nobject pool to represent a commit entity than the generic ObjectId.\n\nWhen creating a new commit we allocate its RevCommit from the pool,\nbut we delay parsing until as late as necessary.  This is needed for\nat least one test where it validates whether or not the parents of a\ncommit were allocated after traversal finishes.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../org/spearce/jgit/revwalk/RevWalkCullTest.java  |   28 +++---\n .../spearce/jgit/revwalk/RevWalkFilterTest.java    |   91 ++++++++++----------\n .../spearce/jgit/revwalk/RevWalkMergeBaseTest.java |   45 +++++-----\n .../org/spearce/jgit/revwalk/RevWalkSortTest.java  |   64 +++++++-------\n .../org/spearce/jgit/revwalk/RevWalkTestCase.java  |   30 +++---\n 5 files changed, 126 insertions(+), 132 deletions(-)\n\ndiff --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\nindex e734273..2f61598 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java\n@@ -37,8 +37,6 @@\n \n package org.spearce.jgit.revwalk;\n \n-import org.spearce.jgit.lib.ObjectId;\n-\n public class RevWalkCullTest extends RevWalkTestCase {\n \tpublic void testProperlyCullAllAncestors1() throws Exception {\n \t\t// Credit goes to Junio C Hamano <gitster@pobox.com> for this\n@@ -46,10 +44,10 @@ public void testProperlyCullAllAncestors1() throws Exception {\n \t\t//\n \t\t// We induce a clock skew so two is dated before one.\n \t\t//\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(-2400, a);\n-\t\tfinal ObjectId c = commit(b);\n-\t\tfinal ObjectId d = commit(c);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(-2400, a);\n+\t\tfinal RevCommit c = commit(b);\n+\t\tfinal RevCommit d = commit(c);\n \n \t\tmarkStart(a);\n \t\tmarkUninteresting(d);\n@@ -60,11 +58,11 @@ public void testProperlyCullAllAncestors2() throws Exception {\n \t\t// Despite clock skew on c1 being very old it should not\n \t\t// produce, neither should a or b, or any part of that chain.\n \t\t//\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c1 = commit(-5, b);\n-\t\tfinal ObjectId c2 = commit(10, b);\n-\t\tfinal ObjectId d = commit(c1, c2);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c1 = commit(-5, b);\n+\t\tfinal RevCommit c2 = commit(10, b);\n+\t\tfinal RevCommit d = commit(c1, c2);\n \n \t\tmarkStart(d);\n \t\tmarkUninteresting(c1);\n@@ -74,14 +72,14 @@ public void testProperlyCullAllAncestors2() throws Exception {\n \t}\n \n \tpublic void testProperlyCullAllAncestors_LongHistory() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tObjectId b = commit(a);\n+\t\tfinal RevCommit a = commit();\n+\t\tRevCommit b = commit(a);\n \t\tfor (int i = 0; i < 24; i++) {\n \t\t\tb = commit(b);\n \t\t\tif ((i & 2) == 0)\n \t\t\t\tmarkUninteresting(b);\n \t\t}\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\tmarkStart(c);\n \t\tmarkUninteresting(b);\n@@ -91,6 +89,6 @@ public void testProperlyCullAllAncestors_LongHistory() throws Exception {\n \t\t// We should have aborted before we got back so far that \"a\"\n \t\t// would be parsed. Thus, its parents shouldn't be allocated.\n \t\t//\n-\t\tassertNull(rw.lookupCommit(a).parents);\n+\t\tassertNull(a.parents);\n \t}\n }\ndiff --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\nindex d079bdc..6a26d2e 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java\n@@ -42,7 +42,6 @@\n import org.spearce.jgit.errors.IncorrectObjectTypeException;\n import org.spearce.jgit.errors.MissingObjectException;\n import org.spearce.jgit.errors.StopWalkException;\n-import org.spearce.jgit.lib.ObjectId;\n import org.spearce.jgit.revwalk.filter.AndRevFilter;\n import org.spearce.jgit.revwalk.filter.NotRevFilter;\n import org.spearce.jgit.revwalk.filter.OrRevFilter;\n@@ -52,9 +51,9 @@\n \tprivate static final MyAll MY_ALL = new MyAll();\n \n \tpublic void testFilter_ALL() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(RevFilter.ALL);\n \t\tmarkStart(c);\n@@ -65,9 +64,9 @@ public void testFilter_ALL() throws Exception {\n \t}\n \n \tpublic void testFilter_Negate_ALL() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(RevFilter.ALL.negate());\n \t\tmarkStart(c);\n@@ -75,9 +74,9 @@ public void testFilter_Negate_ALL() throws Exception {\n \t}\n \n \tpublic void testFilter_NOT_ALL() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(NotRevFilter.create(RevFilter.ALL));\n \t\tmarkStart(c);\n@@ -85,9 +84,9 @@ public void testFilter_NOT_ALL() throws Exception {\n \t}\n \n \tpublic void testFilter_NONE() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(RevFilter.NONE);\n \t\tmarkStart(c);\n@@ -95,9 +94,9 @@ public void testFilter_NONE() throws Exception {\n \t}\n \n \tpublic void testFilter_NOT_NONE() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(NotRevFilter.create(RevFilter.NONE));\n \t\tmarkStart(c);\n@@ -108,9 +107,9 @@ public void testFilter_NOT_NONE() throws Exception {\n \t}\n \n \tpublic void testFilter_ALL_And_NONE() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(AndRevFilter.create(RevFilter.ALL, RevFilter.NONE));\n \t\tmarkStart(c);\n@@ -118,9 +117,9 @@ public void testFilter_ALL_And_NONE() throws Exception {\n \t}\n \n \tpublic void testFilter_NONE_And_ALL() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(AndRevFilter.create(RevFilter.NONE, RevFilter.ALL));\n \t\tmarkStart(c);\n@@ -128,9 +127,9 @@ public void testFilter_NONE_And_ALL() throws Exception {\n \t}\n \n \tpublic void testFilter_ALL_Or_NONE() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(OrRevFilter.create(RevFilter.ALL, RevFilter.NONE));\n \t\tmarkStart(c);\n@@ -141,9 +140,9 @@ public void testFilter_ALL_Or_NONE() throws Exception {\n \t}\n \n \tpublic void testFilter_NONE_Or_ALL() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(OrRevFilter.create(RevFilter.NONE, RevFilter.ALL));\n \t\tmarkStart(c);\n@@ -154,9 +153,9 @@ public void testFilter_NONE_Or_ALL() throws Exception {\n \t}\n \n \tpublic void testFilter_MY_ALL_And_NONE() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(AndRevFilter.create(MY_ALL, RevFilter.NONE));\n \t\tmarkStart(c);\n@@ -164,9 +163,9 @@ public void testFilter_MY_ALL_And_NONE() throws Exception {\n \t}\n \n \tpublic void testFilter_NONE_And_MY_ALL() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(AndRevFilter.create(RevFilter.NONE, MY_ALL));\n \t\tmarkStart(c);\n@@ -174,9 +173,9 @@ public void testFilter_NONE_And_MY_ALL() throws Exception {\n \t}\n \n \tpublic void testFilter_MY_ALL_Or_NONE() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(OrRevFilter.create(MY_ALL, RevFilter.NONE));\n \t\tmarkStart(c);\n@@ -187,9 +186,9 @@ public void testFilter_MY_ALL_Or_NONE() throws Exception {\n \t}\n \n \tpublic void testFilter_NONE_Or_MY_ALL() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n \n \t\trw.setRevFilter(OrRevFilter.create(RevFilter.NONE, MY_ALL));\n \t\tmarkStart(c);\n@@ -200,12 +199,12 @@ public void testFilter_NONE_Or_MY_ALL() throws Exception {\n \t}\n \n \tpublic void testFilter_NO_MERGES() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c1 = commit(b);\n-\t\tfinal ObjectId c2 = commit(b);\n-\t\tfinal ObjectId d = commit(c1, c2);\n-\t\tfinal ObjectId e = commit(d);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c1 = commit(b);\n+\t\tfinal RevCommit c2 = commit(b);\n+\t\tfinal RevCommit d = commit(c1, c2);\n+\t\tfinal RevCommit e = commit(d);\n \n \t\trw.setRevFilter(RevFilter.NO_MERGES);\n \t\tmarkStart(e);\ndiff --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\nindex cec4e3f..fc1a37c 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java\n@@ -37,13 +37,12 @@\n \n package org.spearce.jgit.revwalk;\n \n-import org.spearce.jgit.lib.ObjectId;\n import org.spearce.jgit.revwalk.filter.RevFilter;\n \n public class RevWalkMergeBaseTest extends RevWalkTestCase {\n \tpublic void testNone() throws Exception {\n-\t\tfinal ObjectId c1 = commit(commit(commit()));\n-\t\tfinal ObjectId c2 = commit(commit(commit()));\n+\t\tfinal RevCommit c1 = commit(commit(commit()));\n+\t\tfinal RevCommit c2 = commit(commit(commit()));\n \n \t\trw.setRevFilter(RevFilter.MERGE_BASE);\n \t\tmarkStart(c1);\n@@ -52,10 +51,10 @@ public void testNone() throws Exception {\n \t}\n \n \tpublic void testSimple() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c1 = commit(commit(commit(commit(commit(b)))));\n-\t\tfinal ObjectId c2 = commit(commit(commit(commit(commit(b)))));\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c1 = commit(commit(commit(commit(commit(b)))));\n+\t\tfinal RevCommit c2 = commit(commit(commit(commit(commit(b)))));\n \n \t\trw.setRevFilter(RevFilter.MERGE_BASE);\n \t\tmarkStart(c1);\n@@ -65,11 +64,11 @@ public void testSimple() throws Exception {\n \t}\n \n \tpublic void testMultipleHeads_SameBase1() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c1 = commit(commit(commit(commit(commit(b)))));\n-\t\tfinal ObjectId c2 = commit(commit(commit(commit(commit(b)))));\n-\t\tfinal ObjectId c3 = commit(commit(commit(b)));\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c1 = commit(commit(commit(commit(commit(b)))));\n+\t\tfinal RevCommit c2 = commit(commit(commit(commit(commit(b)))));\n+\t\tfinal RevCommit c3 = commit(commit(commit(b)));\n \n \t\trw.setRevFilter(RevFilter.MERGE_BASE);\n \t\tmarkStart(c1);\n@@ -80,12 +79,12 @@ public void testMultipleHeads_SameBase1() throws Exception {\n \t}\n \n \tpublic void testMultipleHeads_SameBase2() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n-\t\tfinal ObjectId d1 = commit(commit(commit(commit(commit(b)))));\n-\t\tfinal ObjectId d2 = commit(commit(commit(commit(commit(c)))));\n-\t\tfinal ObjectId d3 = commit(commit(commit(c)));\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n+\t\tfinal RevCommit d1 = commit(commit(commit(commit(commit(b)))));\n+\t\tfinal RevCommit d2 = commit(commit(commit(commit(commit(c)))));\n+\t\tfinal RevCommit d3 = commit(commit(commit(c)));\n \n \t\trw.setRevFilter(RevFilter.MERGE_BASE);\n \t\tmarkStart(d1);\n@@ -101,11 +100,11 @@ public void testCrissCross() throws Exception {\n \t\t// clean merge base for d,e as they each merged the parents b,c\n \t\t// in different orders.\n \t\t//\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(a);\n-\t\tfinal ObjectId d = commit(b, c);\n-\t\tfinal ObjectId e = commit(c, b);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(a);\n+\t\tfinal RevCommit d = commit(b, c);\n+\t\tfinal RevCommit e = commit(c, b);\n \n \t\trw.setRevFilter(RevFilter.MERGE_BASE);\n \t\tmarkStart(d);\ndiff --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\nindex 3ed1565..7435197 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java\n@@ -37,14 +37,12 @@\n \n package org.spearce.jgit.revwalk;\n \n-import org.spearce.jgit.lib.ObjectId;\n-\n public class RevWalkSortTest extends RevWalkTestCase {\n \tpublic void testSort_Default() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(1, a);\n-\t\tfinal ObjectId c = commit(1, b);\n-\t\tfinal ObjectId d = commit(1, c);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(1, a);\n+\t\tfinal RevCommit c = commit(1, b);\n+\t\tfinal RevCommit d = commit(1, c);\n \n \t\tmarkStart(d);\n \t\tassertCommit(d, rw.next());\n@@ -55,10 +53,10 @@ public void testSort_Default() throws Exception {\n \t}\n \n \tpublic void testSort_COMMIT_TIME_DESC() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n-\t\tfinal ObjectId d = commit(c);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n+\t\tfinal RevCommit d = commit(c);\n \n \t\trw.sort(RevSort.COMMIT_TIME_DESC);\n \t\tmarkStart(d);\n@@ -70,10 +68,10 @@ public void testSort_COMMIT_TIME_DESC() throws Exception {\n \t}\n \n \tpublic void testSort_REVERSE() throws Exception {\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(b);\n-\t\tfinal ObjectId d = commit(c);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(b);\n+\t\tfinal RevCommit d = commit(c);\n \n \t\trw.sort(RevSort.REVERSE);\n \t\tmarkStart(d);\n@@ -88,10 +86,10 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder1() throws Exception {\n \t\t// Despite being out of order time-wise, a strand-of-pearls must\n \t\t// still maintain topological order.\n \t\t//\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c = commit(-5, b);\n-\t\tfinal ObjectId d = commit(10, c);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c = commit(-5, b);\n+\t\tfinal RevCommit d = commit(10, c);\n \t\tassertTrue(parse(a).getCommitTime() < parse(d).getCommitTime());\n \t\tassertTrue(parse(c).getCommitTime() < parse(b).getCommitTime());\n \n@@ -107,11 +105,11 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder1() throws Exception {\n \tpublic void testSort_COMMIT_TIME_DESC_OutOfOrder2() throws Exception {\n \t\t// c1 is back dated before its parent.\n \t\t//\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c1 = commit(-5, b);\n-\t\tfinal ObjectId c2 = commit(10, b);\n-\t\tfinal ObjectId d = commit(c1, c2);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c1 = commit(-5, b);\n+\t\tfinal RevCommit c2 = commit(10, b);\n+\t\tfinal RevCommit d = commit(c1, c2);\n \n \t\trw.sort(RevSort.COMMIT_TIME_DESC);\n \t\tmarkStart(d);\n@@ -126,11 +124,11 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder2() throws Exception {\n \tpublic void testSort_TOPO() throws Exception {\n \t\t// c1 is back dated before its parent.\n \t\t//\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c1 = commit(-5, b);\n-\t\tfinal ObjectId c2 = commit(10, b);\n-\t\tfinal ObjectId d = commit(c1, c2);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c1 = commit(-5, b);\n+\t\tfinal RevCommit c2 = commit(10, b);\n+\t\tfinal RevCommit d = commit(c1, c2);\n \n \t\trw.sort(RevSort.TOPO);\n \t\tmarkStart(d);\n@@ -145,11 +143,11 @@ public void testSort_TOPO() throws Exception {\n \tpublic void testSort_TOPO_REVERSE() throws Exception {\n \t\t// c1 is back dated before its parent.\n \t\t//\n-\t\tfinal ObjectId a = commit();\n-\t\tfinal ObjectId b = commit(a);\n-\t\tfinal ObjectId c1 = commit(-5, b);\n-\t\tfinal ObjectId c2 = commit(10, b);\n-\t\tfinal ObjectId d = commit(c1, c2);\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tfinal RevCommit c1 = commit(-5, b);\n+\t\tfinal RevCommit c2 = commit(10, b);\n+\t\tfinal RevCommit d = commit(c1, c2);\n \n \t\trw.sort(RevSort.TOPO);\n \t\trw.sort(RevSort.REVERSE, true);\ndiff --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\nindex a477be9..f83be8d 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java\n@@ -40,7 +40,6 @@\n import java.util.Date;\n \n import org.spearce.jgit.lib.Commit;\n-import org.spearce.jgit.lib.ObjectId;\n import org.spearce.jgit.lib.ObjectWriter;\n import org.spearce.jgit.lib.PersonIdent;\n import org.spearce.jgit.lib.RepositoryTestCase;\n@@ -50,7 +49,7 @@\n public abstract class RevWalkTestCase extends RepositoryTestCase {\n \tprotected ObjectWriter ow;\n \n-\tprotected ObjectId emptyTree;\n+\tprotected RevTree emptyTree;\n \n \tprotected long nowTick;\n \n@@ -59,20 +58,20 @@\n \tpublic void setUp() throws Exception {\n \t\tsuper.setUp();\n \t\tow = new ObjectWriter(db);\n-\t\temptyTree = ow.writeTree(new Tree(db));\n-\t\tnowTick = 1236977987000L;\n \t\trw = new RevWalk(db);\n+\t\temptyTree = rw.parseTree(ow.writeTree(new Tree(db)));\n+\t\tnowTick = 1236977987000L;\n \t}\n \n \tprotected void tick(final int secDelta) {\n \t\tnowTick += secDelta * 1000L;\n \t}\n \n-\tprotected ObjectId commit(final ObjectId... parents) throws Exception {\n+\tprotected RevCommit commit(final RevCommit... parents) throws Exception {\n \t\treturn commit(1, parents);\n \t}\n \n-\tprotected ObjectId commit(final int secDelta, final ObjectId... parents)\n+\tprotected RevCommit commit(final int secDelta, final RevCommit... parents)\n \t\t\tthrows Exception {\n \t\ttick(secDelta);\n \t\tfinal Commit c = new Commit(db);\n@@ -81,22 +80,23 @@ protected ObjectId commit(final int secDelta, final ObjectId... parents)\n \t\tc.setAuthor(new PersonIdent(jauthor, new Date(nowTick)));\n \t\tc.setCommitter(new PersonIdent(jcommitter, new Date(nowTick)));\n \t\tc.setMessage(\"\");\n-\t\treturn ow.writeCommit(c);\n+\t\treturn rw.lookupCommit(ow.writeCommit(c));\n \t}\n \n-\tprotected RevCommit parse(final ObjectId commitId) throws Exception {\n-\t\treturn rw.parseCommit(commitId);\n+\tprotected <T extends RevObject> T parse(final T t) throws Exception {\n+\t\trw.parse(t);\n+\t\treturn t;\n \t}\n \n-\tprotected void markStart(final ObjectId commitId) throws Exception {\n-\t\trw.markStart(parse(commitId));\n+\tprotected void markStart(final RevCommit commit) throws Exception {\n+\t\trw.markStart(commit);\n \t}\n \n-\tprotected void markUninteresting(final ObjectId commitId) throws Exception {\n-\t\trw.markUninteresting(parse(commitId));\n+\tprotected void markUninteresting(final RevCommit commit) throws Exception {\n+\t\trw.markUninteresting(commit);\n \t}\n \n-\tprotected void assertCommit(final ObjectId commitId, final RevCommit commit) {\n-\t\tassertEquals(commitId.name(), commit != null ? commit.name() : null);\n+\tprotected void assertCommit(final RevCommit exp, final RevCommit act) {\n+\t\tassertSame(exp, act);\n \t}\n }\n-- \n1.6.2.1.286.g8173\n"},{"id":"108313","messageId":"1237340451-31562-5-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-4-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 04/12] Test that RevFilter.MERGE_BASE cannot use a TreeFilter","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:43Z","receivedAt":"2009-03-18T01:40:43Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Only TreeFilter.ALL is permitted right now when computing a merge\nbase, as the generator pipeline doesn't support parent rewrites\nduring a merge base computation.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../spearce/jgit/revwalk/RevWalkMergeBaseTest.java |   17 +++++++++++++++++\n 1 files changed, 17 insertions(+), 0 deletions(-)\n\ndiff --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\nindex fc1a37c..c8fdf5e 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java\n@@ -38,6 +38,7 @@\n package org.spearce.jgit.revwalk;\n \n import org.spearce.jgit.revwalk.filter.RevFilter;\n+import org.spearce.jgit.treewalk.filter.TreeFilter;\n \n public class RevWalkMergeBaseTest extends RevWalkTestCase {\n \tpublic void testNone() throws Exception {\n@@ -50,6 +51,22 @@ public void testNone() throws Exception {\n \t\tassertNull(rw.next());\n \t}\n \n+\tpublic void testDisallowTreeFilter() throws Exception {\n+\t\tfinal RevCommit c1 = commit();\n+\t\tfinal RevCommit c2 = commit();\n+\n+\t\trw.setRevFilter(RevFilter.MERGE_BASE);\n+\t\trw.setTreeFilter(TreeFilter.ANY_DIFF);\n+\t\tmarkStart(c1);\n+\t\tmarkStart(c2);\n+\t\ttry {\n+\t\t\tassertNull(rw.next());\n+\t\t\tfail(\"did not throw IllegalStateException\");\n+\t\t} catch (IllegalStateException ise) {\n+\t\t\t// expected result\n+\t\t}\n+\t}\n+\n \tpublic void testSimple() throws Exception {\n \t\tfinal RevCommit a = commit();\n \t\tfinal RevCommit b = commit(a);\n-- \n1.6.2.1.286.g8173\n"},{"id":"108318","messageId":"1237340451-31562-6-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-5-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 05/12] Add unit tests for DateRevQueue","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:44Z","receivedAt":"2009-03-18T01:40:44Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../org/spearce/jgit/revwalk/DateRevQueueTest.java |  118 ++++++++++++++++++++\n .../org/spearce/jgit/revwalk/RevQueueTestCase.java |   85 ++++++++++++++\n 2 files changed, 203 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java\nnew file mode 100644\nindex 0000000..c29fd55\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java\n@@ -0,0 +1,118 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+public class DateRevQueueTest extends RevQueueTestCase<DateRevQueue> {\n+\tprotected DateRevQueue create() {\n+\t\treturn new DateRevQueue();\n+\t}\n+\n+\tpublic void testEmpty() throws Exception {\n+\t\tsuper.testEmpty();\n+\t\tassertNull(q.peek());\n+\t\tassertEquals(Generator.SORT_COMMIT_TIME_DESC, q.outputType());\n+\t}\n+\n+\tpublic void testCloneEmpty() throws Exception {\n+\t\tq = new DateRevQueue(AbstractRevQueue.EMPTY_QUEUE);\n+\t\tassertNull(q.next());\n+\t}\n+\n+\tpublic void testInsertOutOfOrder() throws Exception {\n+\t\tfinal RevCommit a = parse(commit());\n+\t\tfinal RevCommit b = parse(commit(10, a));\n+\t\tfinal RevCommit c1 = parse(commit(5, b));\n+\t\tfinal RevCommit c2 = parse(commit(-50, b));\n+\n+\t\tq.add(c2);\n+\t\tq.add(a);\n+\t\tq.add(b);\n+\t\tq.add(c1);\n+\n+\t\tassertCommit(c1, q.next());\n+\t\tassertCommit(b, q.next());\n+\t\tassertCommit(a, q.next());\n+\t\tassertCommit(c2, q.next());\n+\t\tassertNull(q.next());\n+\t}\n+\n+\tpublic void testInsertTie() throws Exception {\n+\t\tfinal RevCommit a = parse(commit());\n+\t\tfinal RevCommit b = parse(commit(0, a));\n+\t\t{\n+\t\t\tq = create();\n+\t\t\tq.add(a);\n+\t\t\tq.add(b);\n+\n+\t\t\tassertCommit(a, q.next());\n+\t\t\tassertCommit(b, q.next());\n+\t\t\tassertNull(q.next());\n+\t\t}\n+\t\t{\n+\t\t\tq = create();\n+\t\t\tq.add(b);\n+\t\t\tq.add(a);\n+\n+\t\t\tassertCommit(b, q.next());\n+\t\t\tassertCommit(a, q.next());\n+\t\t\tassertNull(q.next());\n+\t\t}\n+\t}\n+\n+\tpublic void testCloneFIFO() throws Exception {\n+\t\tfinal RevCommit a = parse(commit());\n+\t\tfinal RevCommit b = parse(commit(200, a));\n+\t\tfinal RevCommit c = parse(commit(200, b));\n+\n+\t\tfinal FIFORevQueue src = new FIFORevQueue();\n+\t\tsrc.add(a);\n+\t\tsrc.add(b);\n+\t\tsrc.add(c);\n+\n+\t\tq = new DateRevQueue(src);\n+\t\tassertFalse(q.everbodyHasFlag(RevWalk.UNINTERESTING));\n+\t\tassertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));\n+\t\tassertCommit(c, q.peek());\n+\t\tassertCommit(c, q.peek());\n+\n+\t\tassertCommit(c, q.next());\n+\t\tassertCommit(b, q.next());\n+\t\tassertCommit(a, q.next());\n+\t\tassertNull(q.next());\n+\t}\n+}\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java\nnew file mode 100644\nindex 0000000..8b379d6\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java\n@@ -0,0 +1,85 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+public abstract class RevQueueTestCase<T extends AbstractRevQueue> extends\n+\t\tRevWalkTestCase {\n+\tprotected T q;\n+\n+\tpublic void setUp() throws Exception {\n+\t\tsuper.setUp();\n+\t\tq = create();\n+\t}\n+\n+\tprotected abstract T create();\n+\n+\tpublic void testEmpty() throws Exception {\n+\t\tassertNull(q.next());\n+\t\tassertTrue(q.everbodyHasFlag(RevWalk.UNINTERESTING));\n+\t\tassertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));\n+\t}\n+\n+\tpublic void testClear() throws Exception {\n+\t\tfinal RevCommit a = parse(commit());\n+\t\tfinal RevCommit b = parse(commit(a));\n+\n+\t\tq.add(a);\n+\t\tq.add(b);\n+\t\tq.clear();\n+\t\tassertNull(q.next());\n+\t}\n+\n+\tpublic void testHasFlags() throws Exception {\n+\t\tfinal RevCommit a = parse(commit());\n+\t\tfinal RevCommit b = parse(commit(a));\n+\n+\t\tq.add(a);\n+\t\tq.add(b);\n+\n+\t\tassertFalse(q.everbodyHasFlag(RevWalk.UNINTERESTING));\n+\t\tassertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));\n+\n+\t\ta.flags |= RevWalk.UNINTERESTING;\n+\t\tassertFalse(q.everbodyHasFlag(RevWalk.UNINTERESTING));\n+\t\tassertTrue(q.anybodyHasFlag(RevWalk.UNINTERESTING));\n+\n+\t\tb.flags |= RevWalk.UNINTERESTING;\n+\t\tassertTrue(q.everbodyHasFlag(RevWalk.UNINTERESTING));\n+\t\tassertTrue(q.anybodyHasFlag(RevWalk.UNINTERESTING));\n+\t}\n+}\n-- \n1.6.2.1.286.g8173\n"},{"id":"108314","messageId":"1237340451-31562-7-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-6-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 06/12] Add unit tests for FIFORevQueue","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:45Z","receivedAt":"2009-03-18T01:40:45Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../org/spearce/jgit/revwalk/FIFORevQueueTest.java |   81 ++++++++++++++++++++\n .../org/spearce/jgit/revwalk/BlockRevQueue.java    |    2 +-\n 2 files changed, 82 insertions(+), 1 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java\nnew file mode 100644\nindex 0000000..99ee031\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java\n@@ -0,0 +1,81 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+import java.util.ArrayList;\n+\n+public class FIFORevQueueTest extends RevQueueTestCase<FIFORevQueue> {\n+\tprotected FIFORevQueue create() {\n+\t\treturn new FIFORevQueue();\n+\t}\n+\n+\tpublic void testEmpty() throws Exception {\n+\t\tsuper.testEmpty();\n+\t\tassertEquals(0, q.outputType());\n+\t}\n+\n+\tpublic void testCloneEmpty() throws Exception {\n+\t\tq = new FIFORevQueue(AbstractRevQueue.EMPTY_QUEUE);\n+\t\tassertNull(q.next());\n+\t}\n+\n+\tpublic void testAddLargeBlocks() throws Exception {\n+\t\tfinal ArrayList<RevCommit> lst = new ArrayList<RevCommit>();\n+\t\tfor (int i = 0; i < 3 * BlockRevQueue.Block.BLOCK_SIZE; i++) {\n+\t\t\tfinal RevCommit c = commit();\n+\t\t\tlst.add(c);\n+\t\t\tq.add(c);\n+\t\t}\n+\t\tfor (int i = 0; i < lst.size(); i++)\n+\t\t\tassertSame(lst.get(i), q.next());\n+\t}\n+\n+\tpublic void testUnpopAtFront() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit();\n+\t\tfinal RevCommit c = commit();\n+\n+\t\tq.add(a);\n+\t\tq.unpop(b);\n+\t\tq.unpop(c);\n+\n+\t\tassertSame(c, q.next());\n+\t\tassertSame(b, q.next());\n+\t\tassertSame(a, q.next());\n+\t}\n+}\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/BlockRevQueue.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/BlockRevQueue.java\nindex 9660de8..8c0e46d 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/BlockRevQueue.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/BlockRevQueue.java\n@@ -104,7 +104,7 @@ void clear() {\n \t}\n \n \tstatic final class Block {\n-\t\tprivate static final int BLOCK_SIZE = 256;\n+\t\tstatic final int BLOCK_SIZE = 256;\n \n \t\t/** Next block in our chain of blocks; null if we are the last. */\n \t\tBlock next;\n-- \n1.6.2.1.286.g8173\n"},{"id":"108321","messageId":"1237340451-31562-8-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-7-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 07/12] Add unit tests for LIFORevQueue","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:46Z","receivedAt":"2009-03-18T01:40:46Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../org/spearce/jgit/revwalk/LIFORevQueueTest.java |   69 ++++++++++++++++++++\n 1 files changed, 69 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java\nnew file mode 100644\nindex 0000000..b1ce5fa\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java\n@@ -0,0 +1,69 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+import java.util.ArrayList;\n+import java.util.Collections;\n+\n+public class LIFORevQueueTest extends RevQueueTestCase<LIFORevQueue> {\n+\tprotected LIFORevQueue create() {\n+\t\treturn new LIFORevQueue();\n+\t}\n+\n+\tpublic void testEmpty() throws Exception {\n+\t\tsuper.testEmpty();\n+\t\tassertEquals(0, q.outputType());\n+\t}\n+\n+\tpublic void testCloneEmpty() throws Exception {\n+\t\tq = new LIFORevQueue(AbstractRevQueue.EMPTY_QUEUE);\n+\t\tassertNull(q.next());\n+\t}\n+\n+\tpublic void testAddLargeBlocks() throws Exception {\n+\t\tfinal ArrayList<RevCommit> lst = new ArrayList<RevCommit>();\n+\t\tfor (int i = 0; i < 3 * BlockRevQueue.Block.BLOCK_SIZE; i++) {\n+\t\t\tfinal RevCommit c = commit();\n+\t\t\tlst.add(c);\n+\t\t\tq.add(c);\n+\t\t}\n+\t\tCollections.reverse(lst);\n+\t\tfor (int i = 0; i < lst.size(); i++)\n+\t\t\tassertSame(lst.get(i), q.next());\n+\t}\n+}\n-- \n1.6.2.1.286.g8173\n"},{"id":"108319","messageId":"1237340451-31562-9-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-8-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 08/12] Add unit tests for AbstractRevQueue.EMPTY_QUEUE","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:47Z","receivedAt":"2009-03-18T01:40:47Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Also fix anybodyHasFlag() to return false, as the queue is empty,\nand thus nobody has that flag.  This matches the behavior of the\nother queue types.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../jgit/revwalk/AlwaysEmptyRevQueueTest.java      |   63 ++++++++++++++++++++\n .../org/spearce/jgit/revwalk/AbstractRevQueue.java |    2 +-\n 2 files changed, 64 insertions(+), 1 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java\nnew file mode 100644\nindex 0000000..94edd0a\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java\n@@ -0,0 +1,63 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+public class AlwaysEmptyRevQueueTest extends RevWalkTestCase {\n+\tprivate final AbstractRevQueue q = AbstractRevQueue.EMPTY_QUEUE;\n+\n+\tpublic void testEmpty() throws Exception {\n+\t\tassertNull(q.next());\n+\t\tassertTrue(q.everbodyHasFlag(RevWalk.UNINTERESTING));\n+\t\tassertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));\n+\t\tassertEquals(0, q.outputType());\n+\t}\n+\n+\tpublic void testClear() throws Exception {\n+\t\tq.clear();\n+\t\ttestEmpty();\n+\t}\n+\n+\tpublic void testAddFails() throws Exception {\n+\t\ttry {\n+\t\t\tq.add(commit());\n+\t\t\tfail(\"Did not throw UnsupportedOperationException\");\n+\t\t} catch (UnsupportedOperationException e) {\n+\t\t\t// expected result\n+\t\t}\n+\t}\n+}\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java\nindex 5bb969d..9a6bf81 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java\n@@ -133,7 +133,7 @@ public RevCommit next() {\n \n \t\t@Override\n \t\tboolean anybodyHasFlag(int f) {\n-\t\t\treturn true;\n+\t\t\treturn false;\n \t\t}\n \n \t\t@Override\n-- \n1.6.2.1.286.g8173\n"},{"id":"108320","messageId":"1237340451-31562-10-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-9-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 09/12] Add tests for basic RevObject methods related to type, flags","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:48Z","receivedAt":"2009-03-18T01:40:48Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../org/spearce/jgit/revwalk/RevObjectTest.java    |  171 ++++++++++++++++++++\n .../org/spearce/jgit/revwalk/RevWalkTestCase.java  |   18 ++\n 2 files changed, 189 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java\nnew file mode 100644\nindex 0000000..0eaafbf\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java\n@@ -0,0 +1,171 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+import org.spearce.jgit.lib.AnyObjectId;\n+import org.spearce.jgit.lib.Constants;\n+\n+public class RevObjectTest extends RevWalkTestCase {\n+\tpublic void testId() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tassertSame(a, a.getId());\n+\t}\n+\n+\tpublic void testEqualsIsIdentity() throws Exception {\n+\t\tfinal RevCommit a1 = commit();\n+\t\tfinal RevCommit b1 = commit();\n+\n+\t\tassertTrue(a1.equals(a1));\n+\t\tassertTrue(a1.equals((Object) a1));\n+\t\tassertFalse(a1.equals(b1));\n+\n+\t\tassertFalse(a1.equals(a1.copy()));\n+\t\tassertFalse(a1.equals((Object) a1.copy()));\n+\t\tassertFalse(a1.equals(\"\"));\n+\n+\t\tfinal RevWalk rw2 = new RevWalk(db);\n+\t\tfinal RevCommit a2 = rw2.parseCommit(a1);\n+\t\tfinal RevCommit b2 = rw2.parseCommit(b1);\n+\t\tassertNotSame(a1, a2);\n+\t\tassertNotSame(b1, b2);\n+\n+\t\tassertFalse(a1.equals(a2));\n+\t\tassertFalse(b1.equals(b2));\n+\n+\t\tassertEquals(a1.hashCode(), a2.hashCode());\n+\t\tassertEquals(b1.hashCode(), b2.hashCode());\n+\n+\t\tassertTrue(AnyObjectId.equals(a1, a2));\n+\t\tassertTrue(AnyObjectId.equals(b1, b2));\n+\t}\n+\n+\tpublic void testRevObjectTypes() throws Exception {\n+\t\tassertEquals(Constants.OBJ_TREE, emptyTree.getType());\n+\t\tassertEquals(Constants.OBJ_COMMIT, commit().getType());\n+\t\tassertEquals(Constants.OBJ_BLOB, blob(\"\").getType());\n+\t\tassertEquals(Constants.OBJ_TAG, tag(\"emptyTree\", emptyTree).getType());\n+\t}\n+\n+\tpublic void testHasRevFlag() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tassertFalse(a.has(RevFlag.UNINTERESTING));\n+\t\ta.flags |= RevWalk.UNINTERESTING;\n+\t\tassertTrue(a.has(RevFlag.UNINTERESTING));\n+\t}\n+\n+\tpublic void testHasAnyFlag() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevFlag flag1 = rw.newFlag(\"flag1\");\n+\t\tfinal RevFlag flag2 = rw.newFlag(\"flag2\");\n+\t\tfinal RevFlagSet s = new RevFlagSet();\n+\t\ts.add(flag1);\n+\t\ts.add(flag2);\n+\n+\t\tassertFalse(a.hasAny(s));\n+\t\ta.flags |= flag1.mask;\n+\t\tassertTrue(a.hasAny(s));\n+\t}\n+\n+\tpublic void testHasAllFlag() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevFlag flag1 = rw.newFlag(\"flag1\");\n+\t\tfinal RevFlag flag2 = rw.newFlag(\"flag2\");\n+\t\tfinal RevFlagSet s = new RevFlagSet();\n+\t\ts.add(flag1);\n+\t\ts.add(flag2);\n+\n+\t\tassertFalse(a.hasAll(s));\n+\t\ta.flags |= flag1.mask;\n+\t\tassertFalse(a.hasAll(s));\n+\t\ta.flags |= flag2.mask;\n+\t\tassertTrue(a.hasAll(s));\n+\t}\n+\n+\tpublic void testAddRevFlag() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevFlag flag1 = rw.newFlag(\"flag1\");\n+\t\tfinal RevFlag flag2 = rw.newFlag(\"flag2\");\n+\t\tassertEquals(0, a.flags);\n+\n+\t\ta.add(flag1);\n+\t\tassertEquals(flag1.mask, a.flags);\n+\n+\t\ta.add(flag2);\n+\t\tassertEquals(flag1.mask | flag2.mask, a.flags);\n+\t}\n+\n+\tpublic void testAddRevFlagSet() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevFlag flag1 = rw.newFlag(\"flag1\");\n+\t\tfinal RevFlag flag2 = rw.newFlag(\"flag2\");\n+\t\tfinal RevFlagSet s = new RevFlagSet();\n+\t\ts.add(flag1);\n+\t\ts.add(flag2);\n+\n+\t\tassertEquals(0, a.flags);\n+\n+\t\ta.add(s);\n+\t\tassertEquals(flag1.mask | flag2.mask, a.flags);\n+\t}\n+\n+\tpublic void testRemoveRevFlag() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevFlag flag1 = rw.newFlag(\"flag1\");\n+\t\tfinal RevFlag flag2 = rw.newFlag(\"flag2\");\n+\t\ta.add(flag1);\n+\t\ta.add(flag2);\n+\t\tassertEquals(flag1.mask | flag2.mask, a.flags);\n+\t\ta.remove(flag2);\n+\t\tassertEquals(flag1.mask, a.flags);\n+\t}\n+\n+\tpublic void testRemoveRevFlagSet() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevFlag flag1 = rw.newFlag(\"flag1\");\n+\t\tfinal RevFlag flag2 = rw.newFlag(\"flag2\");\n+\t\tfinal RevFlag flag3 = rw.newFlag(\"flag3\");\n+\t\tfinal RevFlagSet s = new RevFlagSet();\n+\t\ts.add(flag1);\n+\t\ts.add(flag2);\n+\t\ta.add(flag3);\n+\t\ta.add(s);\n+\t\tassertEquals(flag1.mask | flag2.mask | flag3.mask, a.flags);\n+\t\ta.remove(s);\n+\t\tassertEquals(flag3.mask, a.flags);\n+\t}\n+}\ndiff --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\nindex f83be8d..501aa13 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java\n@@ -40,9 +40,11 @@\n import java.util.Date;\n \n import org.spearce.jgit.lib.Commit;\n+import org.spearce.jgit.lib.Constants;\n import org.spearce.jgit.lib.ObjectWriter;\n import org.spearce.jgit.lib.PersonIdent;\n import org.spearce.jgit.lib.RepositoryTestCase;\n+import org.spearce.jgit.lib.Tag;\n import org.spearce.jgit.lib.Tree;\n \n /** Support for tests of the {@link RevWalk} class. */\n@@ -67,6 +69,11 @@ protected void tick(final int secDelta) {\n \t\tnowTick += secDelta * 1000L;\n \t}\n \n+\tprotected RevBlob blob(final String content) throws Exception {\n+\t\treturn rw.lookupBlob(ow.writeBlob(content\n+\t\t\t\t.getBytes(Constants.CHARACTER_ENCODING)));\n+\t}\n+\n \tprotected RevCommit commit(final RevCommit... parents) throws Exception {\n \t\treturn commit(1, parents);\n \t}\n@@ -83,6 +90,17 @@ protected RevCommit commit(final int secDelta, final RevCommit... parents)\n \t\treturn rw.lookupCommit(ow.writeCommit(c));\n \t}\n \n+\tprotected RevTag tag(final String name, final RevObject dst)\n+\t\t\tthrows Exception {\n+\t\tfinal Tag t = new Tag(db);\n+\t\tt.setType(Constants.typeString(dst.getType()));\n+\t\tt.setObjId(dst.toObjectId());\n+\t\tt.setTag(name);\n+\t\tt.setTagger(new PersonIdent(jcommitter, new Date(nowTick)));\n+\t\tt.setMessage(\"\");\n+\t\treturn (RevTag) rw.lookupAny(ow.writeTag(t), Constants.OBJ_TAG);\n+\t}\n+\n \tprotected <T extends RevObject> T parse(final T t) throws Exception {\n \t\trw.parse(t);\n \t\treturn t;\n-- \n1.6.2.1.286.g8173\n"},{"id":"108315","messageId":"1237340451-31562-11-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-10-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 10/12] Add tests for ObjectWalk","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:49Z","receivedAt":"2009-03-18T01:40:49Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"This covers most of the common operations in an ObjectWalk, such\nas culling off a common base and any trees reachable from that\ncommon base.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../org/spearce/jgit/revwalk/ObjectWalkTest.java   |  190 ++++++++++++++++++++\n .../org/spearce/jgit/revwalk/RevWalkTestCase.java  |   64 +++++++-\n 2 files changed, 251 insertions(+), 3 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java\nnew file mode 100644\nindex 0000000..86f4277\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java\n@@ -0,0 +1,190 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+public class ObjectWalkTest extends RevWalkTestCase {\n+\tprotected ObjectWalk objw;\n+\n+\tprotected RevWalk createRevWalk() {\n+\t\treturn objw = new ObjectWalk(db);\n+\t}\n+\n+\tpublic void testNoCommits() throws Exception {\n+\t\tassertNull(objw.next());\n+\t\tassertNull(objw.nextObject());\n+\t}\n+\n+\tpublic void testTwoCommitsEmptyTree() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfinal RevCommit b = commit(a);\n+\t\tmarkStart(b);\n+\n+\t\tassertCommit(b, objw.next());\n+\t\tassertCommit(a, objw.next());\n+\t\tassertNull(objw.next());\n+\n+\t\tassertSame(emptyTree, objw.nextObject());\n+\t\tassertNull(objw.nextObject());\n+\t}\n+\n+\tpublic void testOneCommitOneTreeTwoBlob() throws Exception {\n+\t\tfinal RevBlob f0 = blob(\"0\");\n+\t\tfinal RevBlob f1 = blob(\"1\");\n+\t\tfinal RevTree t = tree(file(\"0\", f0), file(\"1\", f1), file(\"2\", f1));\n+\t\tfinal RevCommit a = commit(t);\n+\t\tmarkStart(a);\n+\n+\t\tassertCommit(a, objw.next());\n+\t\tassertNull(objw.next());\n+\n+\t\tassertSame(t, objw.nextObject());\n+\t\tassertSame(f0, objw.nextObject());\n+\t\tassertSame(f1, objw.nextObject());\n+\t\tassertNull(objw.nextObject());\n+\t}\n+\n+\tpublic void testTwoCommitTwoTreeTwoBlob() throws Exception {\n+\t\tfinal RevBlob f0 = blob(\"0\");\n+\t\tfinal RevBlob f1 = blob(\"1\");\n+\t\tfinal RevBlob f2 = blob(\"0v2\");\n+\t\tfinal RevTree ta = tree(file(\"0\", f0), file(\"1\", f1), file(\"2\", f1));\n+\t\tfinal RevTree tb = tree(file(\"0\", f2), file(\"1\", f1), file(\"2\", f1));\n+\t\tfinal RevCommit a = commit(ta);\n+\t\tfinal RevCommit b = commit(tb, a);\n+\t\tmarkStart(b);\n+\n+\t\tassertCommit(b, objw.next());\n+\t\tassertCommit(a, objw.next());\n+\t\tassertNull(objw.next());\n+\n+\t\tassertSame(tb, objw.nextObject());\n+\t\tassertSame(f2, objw.nextObject());\n+\t\tassertSame(f1, objw.nextObject());\n+\n+\t\tassertSame(ta, objw.nextObject());\n+\t\tassertSame(f0, objw.nextObject());\n+\n+\t\tassertNull(objw.nextObject());\n+\t}\n+\n+\tpublic void testTwoCommitDeepTree1() throws Exception {\n+\t\tfinal RevBlob f0 = blob(\"0\");\n+\t\tfinal RevBlob f1 = blob(\"0v2\");\n+\t\tfinal RevTree ta = tree(file(\"a/b/0\", f0));\n+\t\tfinal RevTree tb = tree(file(\"a/b/1\", f1));\n+\t\tfinal RevCommit a = commit(ta);\n+\t\tfinal RevCommit b = commit(tb, a);\n+\t\tmarkStart(b);\n+\n+\t\tassertCommit(b, objw.next());\n+\t\tassertCommit(a, objw.next());\n+\t\tassertNull(objw.next());\n+\n+\t\tassertSame(tb, objw.nextObject());\n+\t\tassertSame(get(tb, \"a\"), objw.nextObject());\n+\t\tassertSame(get(tb, \"a/b\"), objw.nextObject());\n+\t\tassertSame(f1, objw.nextObject());\n+\n+\t\tassertSame(ta, objw.nextObject());\n+\t\tassertSame(get(ta, \"a\"), objw.nextObject());\n+\t\tassertSame(get(ta, \"a/b\"), objw.nextObject());\n+\t\tassertSame(f0, objw.nextObject());\n+\n+\t\tassertNull(objw.nextObject());\n+\t}\n+\n+\tpublic void testTwoCommitDeepTree2() throws Exception {\n+\t\tfinal RevBlob f1 = blob(\"1\");\n+\t\tfinal RevTree ta = tree(file(\"a/b/0\", f1), file(\"a/c/q\", f1));\n+\t\tfinal RevTree tb = tree(file(\"a/b/1\", f1), file(\"a/c/q\", f1));\n+\t\tfinal RevCommit a = commit(ta);\n+\t\tfinal RevCommit b = commit(tb, a);\n+\t\tmarkStart(b);\n+\n+\t\tassertCommit(b, objw.next());\n+\t\tassertCommit(a, objw.next());\n+\t\tassertNull(objw.next());\n+\n+\t\tassertSame(tb, objw.nextObject());\n+\t\tassertSame(get(tb, \"a\"), objw.nextObject());\n+\t\tassertSame(get(tb, \"a/b\"), objw.nextObject());\n+\t\tassertSame(f1, objw.nextObject());\n+\t\tassertSame(get(tb, \"a/c\"), objw.nextObject());\n+\n+\t\tassertSame(ta, objw.nextObject());\n+\t\tassertSame(get(ta, \"a\"), objw.nextObject());\n+\t\tassertSame(get(ta, \"a/b\"), objw.nextObject());\n+\n+\t\tassertNull(objw.nextObject());\n+\t}\n+\n+\tpublic void testCull() throws Exception {\n+\t\tfinal RevBlob f1 = blob(\"1\");\n+\t\tfinal RevBlob f2 = blob(\"2\");\n+\t\tfinal RevBlob f3 = blob(\"3\");\n+\t\tfinal RevBlob f4 = blob(\"4\");\n+\n+\t\tfinal RevTree ta = tree(file(\"a/1\", f1), file(\"c/3\", f3));\n+\t\tfinal RevCommit a = commit(ta);\n+\n+\t\tfinal RevTree tb = tree(file(\"a/1\", f2), file(\"c/3\", f3));\n+\t\tfinal RevCommit b1 = commit(tb, a);\n+\t\tfinal RevCommit b2 = commit(tb, b1);\n+\n+\t\tfinal RevTree tc = tree(file(\"a/1\", f4));\n+\t\tfinal RevCommit c1 = commit(tc, a);\n+\t\tfinal RevCommit c2 = commit(tc, c1);\n+\n+\t\tmarkStart(b2);\n+\t\tmarkUninteresting(c2);\n+\n+\t\tassertCommit(b2, objw.next());\n+\t\tassertCommit(b1, objw.next());\n+\t\tassertNull(objw.next());\n+\n+\t\tassertTrue(a.has(RevFlag.UNINTERESTING));\n+\t\tassertTrue(ta.has(RevFlag.UNINTERESTING));\n+\t\tassertTrue(f1.has(RevFlag.UNINTERESTING));\n+\t\tassertTrue(f3.has(RevFlag.UNINTERESTING));\n+\n+\t\tassertSame(tb, objw.nextObject());\n+\t\tassertSame(get(tb, \"a\"), objw.nextObject());\n+\t\tassertSame(f2, objw.nextObject());\n+\t\tassertNull(objw.nextObject());\n+\t}\n+}\ndiff --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\nindex 501aa13..0a1e7b8 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java\n@@ -37,15 +37,23 @@\n \n package org.spearce.jgit.revwalk;\n \n+import java.util.Collections;\n import java.util.Date;\n \n+import org.spearce.jgit.dircache.DirCache;\n+import org.spearce.jgit.dircache.DirCacheBuilder;\n+import org.spearce.jgit.dircache.DirCacheEntry;\n import org.spearce.jgit.lib.Commit;\n import org.spearce.jgit.lib.Constants;\n+import org.spearce.jgit.lib.FileMode;\n+import org.spearce.jgit.lib.ObjectId;\n import org.spearce.jgit.lib.ObjectWriter;\n import org.spearce.jgit.lib.PersonIdent;\n import org.spearce.jgit.lib.RepositoryTestCase;\n import org.spearce.jgit.lib.Tag;\n import org.spearce.jgit.lib.Tree;\n+import org.spearce.jgit.treewalk.TreeWalk;\n+import org.spearce.jgit.treewalk.filter.PathFilterGroup;\n \n /** Support for tests of the {@link RevWalk} class. */\n public abstract class RevWalkTestCase extends RepositoryTestCase {\n@@ -60,11 +68,15 @@\n \tpublic void setUp() throws Exception {\n \t\tsuper.setUp();\n \t\tow = new ObjectWriter(db);\n-\t\trw = new RevWalk(db);\n+\t\trw = createRevWalk();\n \t\temptyTree = rw.parseTree(ow.writeTree(new Tree(db)));\n \t\tnowTick = 1236977987000L;\n \t}\n \n+\tprotected RevWalk createRevWalk() {\n+\t\treturn new RevWalk(db);\n+\t}\n+\n \tprotected void tick(final int secDelta) {\n \t\tnowTick += secDelta * 1000L;\n \t}\n@@ -74,15 +86,61 @@ protected RevBlob blob(final String content) throws Exception {\n \t\t\t\t.getBytes(Constants.CHARACTER_ENCODING)));\n \t}\n \n+\tprotected DirCacheEntry file(final String path, final RevBlob blob)\n+\t\t\tthrows Exception {\n+\t\tfinal DirCacheEntry e = new DirCacheEntry(path);\n+\t\te.setFileMode(FileMode.REGULAR_FILE);\n+\t\te.setObjectId(blob);\n+\t\treturn e;\n+\t}\n+\n+\tprotected RevTree tree(final DirCacheEntry... entries) throws Exception {\n+\t\tfinal DirCache dc = DirCache.newInCore();\n+\t\tfinal DirCacheBuilder b = dc.builder();\n+\t\tfor (final DirCacheEntry e : entries)\n+\t\t\tb.add(e);\n+\t\tb.finish();\n+\t\treturn rw.lookupTree(dc.writeTree(ow));\n+\t}\n+\n+\tprotected RevObject get(final RevTree tree, final String path)\n+\t\t\tthrows Exception {\n+\t\tfinal TreeWalk tw = new TreeWalk(db);\n+\t\ttw.setFilter(PathFilterGroup.createFromStrings(Collections\n+\t\t\t\t.singleton(path)));\n+\t\ttw.reset(tree);\n+\t\twhile (tw.next()) {\n+\t\t\tif (tw.isSubtree() && !path.equals(tw.getPathString())) {\n+\t\t\t\ttw.enterSubtree();\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tfinal ObjectId entid = tw.getObjectId(0);\n+\t\t\tfinal FileMode entmode = tw.getFileMode(0);\n+\t\t\treturn rw.lookupAny(entid, entmode.getObjectType());\n+\t\t}\n+\t\tfail(\"Can't find \" + path + \" in tree \" + tree.name());\n+\t\treturn null; // never reached.\n+\t}\n+\n \tprotected RevCommit commit(final RevCommit... parents) throws Exception {\n-\t\treturn commit(1, parents);\n+\t\treturn commit(1, emptyTree, parents);\n+\t}\n+\n+\tprotected RevCommit commit(final RevTree tree, final RevCommit... parents)\n+\t\t\tthrows Exception {\n+\t\treturn commit(1, tree, parents);\n \t}\n \n \tprotected RevCommit commit(final int secDelta, final RevCommit... parents)\n \t\t\tthrows Exception {\n+\t\treturn commit(secDelta, emptyTree, parents);\n+\t}\n+\n+\tprotected RevCommit commit(final int secDelta, final RevTree tree,\n+\t\t\tfinal RevCommit... parents) throws Exception {\n \t\ttick(secDelta);\n \t\tfinal Commit c = new Commit(db);\n-\t\tc.setTreeId(emptyTree);\n+\t\tc.setTreeId(tree);\n \t\tc.setParentIds(parents);\n \t\tc.setAuthor(new PersonIdent(jauthor, new Date(nowTick)));\n \t\tc.setCommitter(new PersonIdent(jcommitter, new Date(nowTick)));\n-- \n1.6.2.1.286.g8173\n"},{"id":"108316","messageId":"1237340451-31562-12-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-11-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 11/12] Add some basic logic tests for TreeFilter on RevWalk","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:50Z","receivedAt":"2009-03-18T01:40:50Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../jgit/revwalk/RevWalkPathFilter1Test.java       |  176 ++++++++++++++++++++\n 1 files changed, 176 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java\nnew file mode 100644\nindex 0000000..c74ab80\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java\n@@ -0,0 +1,176 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+import java.util.Collections;\n+\n+import org.spearce.jgit.treewalk.filter.AndTreeFilter;\n+import org.spearce.jgit.treewalk.filter.PathFilterGroup;\n+import org.spearce.jgit.treewalk.filter.TreeFilter;\n+\n+public class RevWalkPathFilter1Test extends RevWalkTestCase {\n+\tprotected void filter(final String path) {\n+\t\trw.setTreeFilter(AndTreeFilter.create(PathFilterGroup\n+\t\t\t\t.createFromStrings(Collections.singleton(path)),\n+\t\t\t\tTreeFilter.ANY_DIFF));\n+\t}\n+\n+\tpublic void testEmpty_EmptyTree() throws Exception {\n+\t\tfinal RevCommit a = commit();\n+\t\tfilter(\"a\");\n+\t\tmarkStart(a);\n+\t\tassertNull(rw.next());\n+\t}\n+\n+\tpublic void testEmpty_NoMatch() throws Exception {\n+\t\tfinal RevCommit a = commit(tree(file(\"0\", blob(\"0\"))));\n+\t\tfilter(\"a\");\n+\t\tmarkStart(a);\n+\t\tassertNull(rw.next());\n+\t}\n+\n+\tpublic void testSimple1() throws Exception {\n+\t\tfinal RevCommit a = commit(tree(file(\"0\", blob(\"0\"))));\n+\t\tfilter(\"0\");\n+\t\tmarkStart(a);\n+\t\tassertCommit(a, rw.next());\n+\t\tassertNull(rw.next());\n+\t}\n+\n+\tpublic void testEdits_MatchNone() throws Exception {\n+\t\tfinal RevCommit a = commit(tree(file(\"0\", blob(\"a\"))));\n+\t\tfinal RevCommit b = commit(tree(file(\"0\", blob(\"b\"))), a);\n+\t\tfinal RevCommit c = commit(tree(file(\"0\", blob(\"c\"))), b);\n+\t\tfinal RevCommit d = commit(tree(file(\"0\", blob(\"d\"))), c);\n+\t\tfilter(\"a\");\n+\t\tmarkStart(d);\n+\t\tassertNull(rw.next());\n+\t}\n+\n+\tpublic void testEdits_MatchAll() throws Exception {\n+\t\tfinal RevCommit a = commit(tree(file(\"0\", blob(\"a\"))));\n+\t\tfinal RevCommit b = commit(tree(file(\"0\", blob(\"b\"))), a);\n+\t\tfinal RevCommit c = commit(tree(file(\"0\", blob(\"c\"))), b);\n+\t\tfinal RevCommit d = commit(tree(file(\"0\", blob(\"d\"))), c);\n+\t\tfilter(\"0\");\n+\t\tmarkStart(d);\n+\t\tassertCommit(d, rw.next());\n+\t\tassertCommit(c, rw.next());\n+\t\tassertCommit(b, rw.next());\n+\t\tassertCommit(a, rw.next());\n+\t\tassertNull(rw.next());\n+\t}\n+\n+\tpublic void testStringOfPearls_FilePath1() throws Exception {\n+\t\tfinal RevCommit a = commit(tree(file(\"d/f\", blob(\"a\"))));\n+\t\tfinal RevCommit b = commit(tree(file(\"d/f\", blob(\"a\"))), a);\n+\t\tfinal RevCommit c = commit(tree(file(\"d/f\", blob(\"b\"))), b);\n+\t\tfilter(\"d/f\");\n+\t\tmarkStart(c);\n+\n+\t\tassertCommit(c, rw.next());\n+\t\tassertEquals(1, c.getParentCount());\n+\t\tassertCommit(a, c.getParent(0)); // b was skipped\n+\n+\t\tassertCommit(a, rw.next());\n+\t\tassertEquals(0, a.getParentCount());\n+\t\tassertNull(rw.next());\n+\t}\n+\n+\tpublic void testStringOfPearls_FilePath2() throws Exception {\n+\t\tfinal RevCommit a = commit(tree(file(\"d/f\", blob(\"a\"))));\n+\t\tfinal RevCommit b = commit(tree(file(\"d/f\", blob(\"a\"))), a);\n+\t\tfinal RevCommit c = commit(tree(file(\"d/f\", blob(\"b\"))), b);\n+\t\tfinal RevCommit d = commit(tree(file(\"d/f\", blob(\"b\"))), c);\n+\t\tfilter(\"d/f\");\n+\t\tmarkStart(d);\n+\n+\t\t// d was skipped\n+\t\tassertCommit(c, rw.next());\n+\t\tassertEquals(1, c.getParentCount());\n+\t\tassertCommit(a, c.getParent(0)); // b was skipped\n+\n+\t\tassertCommit(a, rw.next());\n+\t\tassertEquals(0, a.getParentCount());\n+\t\tassertNull(rw.next());\n+\t}\n+\n+\tpublic void testStringOfPearls_DirPath2() throws Exception {\n+\t\tfinal RevCommit a = commit(tree(file(\"d/f\", blob(\"a\"))));\n+\t\tfinal RevCommit b = commit(tree(file(\"d/f\", blob(\"a\"))), a);\n+\t\tfinal RevCommit c = commit(tree(file(\"d/f\", blob(\"b\"))), b);\n+\t\tfinal RevCommit d = commit(tree(file(\"d/f\", blob(\"b\"))), c);\n+\t\tfilter(\"d\");\n+\t\tmarkStart(d);\n+\n+\t\t// d was skipped\n+\t\tassertCommit(c, rw.next());\n+\t\tassertEquals(1, c.getParentCount());\n+\t\tassertCommit(a, c.getParent(0)); // b was skipped\n+\n+\t\tassertCommit(a, rw.next());\n+\t\tassertEquals(0, a.getParentCount());\n+\t\tassertNull(rw.next());\n+\t}\n+\n+\tpublic void testStringOfPearls_FilePath3() throws Exception {\n+\t\tfinal RevCommit a = commit(tree(file(\"d/f\", blob(\"a\"))));\n+\t\tfinal RevCommit b = commit(tree(file(\"d/f\", blob(\"a\"))), a);\n+\t\tfinal RevCommit c = commit(tree(file(\"d/f\", blob(\"b\"))), b);\n+\t\tfinal RevCommit d = commit(tree(file(\"d/f\", blob(\"b\"))), c);\n+\t\tfinal RevCommit e = commit(tree(file(\"d/f\", blob(\"b\"))), d);\n+\t\tfinal RevCommit f = commit(tree(file(\"d/f\", blob(\"b\"))), e);\n+\t\tfinal RevCommit g = commit(tree(file(\"d/f\", blob(\"b\"))), f);\n+\t\tfinal RevCommit h = commit(tree(file(\"d/f\", blob(\"b\"))), g);\n+\t\tfinal RevCommit i = commit(tree(file(\"d/f\", blob(\"c\"))), h);\n+\t\tfilter(\"d/f\");\n+\t\tmarkStart(i);\n+\n+\t\tassertCommit(i, rw.next());\n+\t\tassertEquals(1, i.getParentCount());\n+\t\tassertCommit(c, i.getParent(0)); // h..d was skipped\n+\n+\t\tassertCommit(c, rw.next());\n+\t\tassertEquals(1, c.getParentCount());\n+\t\tassertCommit(a, c.getParent(0)); // b was skipped\n+\n+\t\tassertCommit(a, rw.next());\n+\t\tassertEquals(0, a.getParentCount());\n+\t\tassertNull(rw.next());\n+\t}\n+}\n-- \n1.6.2.1.286.g8173\n"},{"id":"108317","messageId":"1237340451-31562-13-git-send-email-spearce@spearce.org","threadId":"18364","inReplyTo":"1237340451-31562-12-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 12/12] Implement git-core t/t6012-rev-list-simplify test case","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-18T01:40:51Z","receivedAt":"2009-03-18T01:40:51Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"This test case provides a known graph and results that git-core has\nbeen producing since Aug 3, 2008.  Half of the test is commented out\nas JGit does not produce the correct results, or does not support a\nflag necessary to indicate how the results should be determined.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n\n As I said in the series cover letter, this test is more busted\n then correct.  I'm quite sure the test is right, and the JGit\n library is wrong.\n\n .../jgit/revwalk/RevWalkPathFilter6012Test.java    |  162 ++++++++++++++++++++\n 1 files changed, 162 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java\nnew file mode 100644\nindex 0000000..b2fdb16\n--- /dev/null\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java\n@@ -0,0 +1,162 @@\n+/*\n+ * Copyright (C) 2009, Google Inc.\n+ *\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or\n+ * without modification, are permitted provided that the following\n+ * conditions are met:\n+ *\n+ * - Redistributions of source code must retain the above copyright\n+ *   notice, this list of conditions and the following disclaimer.\n+ *\n+ * - Redistributions in binary form must reproduce the above\n+ *   copyright notice, this list of conditions and the following\n+ *   disclaimer in the documentation and/or other materials provided\n+ *   with the distribution.\n+ *\n+ * - Neither the name of the Git Development Community nor the\n+ *   names of its contributors may be used to endorse or promote\n+ *   products derived from this software without specific prior\n+ *   written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n+ * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+package org.spearce.jgit.revwalk;\n+\n+import java.lang.reflect.Field;\n+import java.util.Collections;\n+import java.util.HashMap;\n+\n+import org.spearce.jgit.treewalk.filter.AndTreeFilter;\n+import org.spearce.jgit.treewalk.filter.PathFilterGroup;\n+import org.spearce.jgit.treewalk.filter.TreeFilter;\n+\n+// Note: Much of this test case is broken as it depends upon\n+// the graph applying topological sorting *before* doing merge\n+// simplification.  It also depends upon a difference between\n+// full history and non-full history for a path, something we\n+// don't quite yet have a distiction for in JGit.\n+//\n+public class RevWalkPathFilter6012Test extends RevWalkTestCase {\n+\tprivate static final String pA = \"pA\", pF = \"pF\", pE = \"pE\";\n+\n+\tprivate RevCommit a, b, c, d, e, f, g, h, i;\n+\n+\tprivate HashMap<RevCommit, String> byName;\n+\n+\tpublic void setUp() throws Exception {\n+\t\tsuper.setUp();\n+\n+\t\t// Test graph was stolen from git-core t6012-rev-list-simplify\n+\t\t// (by Junio C Hamano in 65347030590bcc251a9ff2ed96487a0f1b9e9fa8)\n+\t\t//\n+\t\tfinal RevBlob zF = blob(\"zF\");\n+\t\tfinal RevBlob zH = blob(\"zH\");\n+\t\tfinal RevBlob zI = blob(\"zI\");\n+\t\tfinal RevBlob zS = blob(\"zS\");\n+\t\tfinal RevBlob zY = blob(\"zY\");\n+\n+\t\ta = commit(tree(file(pF, zH)));\n+\t\tb = commit(tree(file(pF, zI)), a);\n+\t\tc = commit(tree(file(pF, zI)), a);\n+\t\td = commit(tree(file(pA, zS), file(pF, zI)), c);\n+\t\tparse(d);\n+\t\te = commit(d.getTree(), d, b);\n+\t\tf = commit(tree(file(pA, zS), file(pE, zY), file(pF, zI)), e);\n+\t\tparse(f);\n+\t\tg = commit(tree(file(pE, zY), file(pF, zI)), b);\n+\t\th = commit(f.getTree(), g, f);\n+\t\ti = commit(tree(file(pA, zS), file(pE, zY), file(pF, zF)), h);\n+\n+\t\tbyName = new HashMap<RevCommit, String>();\n+\t\tfor (Field z : RevWalkPathFilter6012Test.class.getDeclaredFields()) {\n+\t\t\tif (z.getType() == RevCommit.class)\n+\t\t\t\tbyName.put((RevCommit) z.get(this), z.getName());\n+\t\t}\n+\t}\n+\n+\tprotected void check(final RevCommit... order) throws Exception {\n+\t\tmarkStart(i);\n+\t\tfinal StringBuilder act = new StringBuilder();\n+\t\tfor (final RevCommit z : rw) {\n+\t\t\tfinal String name = byName.get(z);\n+\t\t\tassertNotNull(name);\n+\t\t\tact.append(name);\n+\t\t\tact.append(' ');\n+\t\t}\n+\t\tfinal StringBuilder exp = new StringBuilder();\n+\t\tfor (final RevCommit z : order) {\n+\t\t\tfinal String name = byName.get(z);\n+\t\t\tassertNotNull(name);\n+\t\t\texp.append(name);\n+\t\t\texp.append(' ');\n+\t\t}\n+\t\tassertEquals(exp.toString(), act.toString());\n+\t}\n+\n+\tprotected void filter(final String path) {\n+\t\trw.setTreeFilter(AndTreeFilter.create(PathFilterGroup\n+\t\t\t\t.createFromStrings(Collections.singleton(path)),\n+\t\t\t\tTreeFilter.ANY_DIFF));\n+\t}\n+\n+\tpublic void test1() throws Exception {\n+\t\t// TODO --full-history\n+\t\tcheck(i, h, g, f, e, d, c, b, a);\n+\t}\n+\n+\tpublic void test2() throws Exception {\n+\t\t// TODO --full-history\n+\t\tfilter(pF);\n+\t\t// TODO fix broken test\n+\t\t// check(i, h, e, c, b, a);\n+\t}\n+\n+\tpublic void test3() throws Exception {\n+\t\t// TODO --full-history\n+\t\trw.sort(RevSort.TOPO);\n+\t\tfilter(pF);\n+\t\t// TODO fix broken test\n+\t\t// check(i, h, e, c, b, a);\n+\t}\n+\n+\tpublic void test4() throws Exception {\n+\t\t// TODO --full-history\n+\t\trw.sort(RevSort.COMMIT_TIME_DESC);\n+\t\tfilter(pF);\n+\t\t// TODO fix broken test\n+\t\t// check(i, h, e, c, b, a);\n+\t}\n+\n+\tpublic void test5() throws Exception {\n+\t\t// TODO --simplify-merges\n+\t\tfilter(pF);\n+\t\t// TODO fix broken test\n+\t\t// check(i, e, c, b, a);\n+\t}\n+\n+\tpublic void test6() throws Exception {\n+\t\tfilter(pF);\n+\t\tcheck(i, b, a);\n+\t}\n+\n+\tpublic void test7() throws Exception {\n+\t\trw.sort(RevSort.TOPO);\n+\t\tfilter(pF);\n+\t\tcheck(i, b, a);\n+\t}\n+}\n-- \n1.6.2.1.286.g8173\n"},{"id":"108343","messageId":"200903180734.59435.robin.rosenberg.lists@dewire.com","threadId":"18364","inReplyTo":"1237340451-31562-1-git-send-email-spearce@spearce.org","subject":"Re: [JGIT PATCH 00/12] Improve test coverage in revwalk","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-03-18T06:34:59Z","receivedAt":"2009-03-18T06:34:59Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"onsdag 18 mars 2009 02:40:39 skrev \"Shawn O. Pearce\" <spearce@spearce.org>:\n> Most of these patches are to improve the test coverage within the\n> revwalk package.\n> \n> \n> The last commit points out what I feared, which is that a RevWalk\n> with a PathFilter applied doesn't produce the same results that\n> git-core would produce in the same situation.  We're either missing\n> some functions necessary to implement it, or we flat out produce\n> a wrong graph in some cases.\n> \n> The tests are commented out because JUnit doesn't have a notion of\n> \"known broken\".  But I did leave in TODO comments.  I'd like to\n> apply the test, and then work later to improve it, but I'm open\n> to suggestions.\n\nIf we'd switch to JUnit4/TestNG we could abuse the expected exception\nannotation.\n\n-- robin\n"},{"id":"108356","messageId":"200903181021.52693.robin.rosenberg.lists@dewire.com","threadId":"18364","inReplyTo":"200903180734.59435.robin.rosenberg.lists@dewire.com","subject":"Re: [JGIT PATCH 00/12] Improve test coverage in revwalk","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-03-18T09:21:52Z","receivedAt":"2009-03-18T09:21:52Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"onsdag 18 mars 2009 07:34:59 skrev Robin Rosenberg <robin.rosenberg.lists@dewire.com>:\n> onsdag 18 mars 2009 02:40:39 skrev \"Shawn O. Pearce\" <spearce@spearce.org>:\n> > The tests are commented out because JUnit doesn't have a notion of\n> > \"known broken\".  But I did leave in TODO comments.  I'd like to\n> > apply the test, and then work later to improve it, but I'm open\n> > to suggestions.\n> \n> If we'd switch to JUnit4/TestNG we could abuse the expected exception\n> annotation.\n\n..or the  @Ignore annotation\n\n-- robin\n"}]}