aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit/src
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2019-08-26 19:05:41 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2019-08-26 19:05:41 -0400
commitf78446b56fb27626b933f3c10e121b28a24fa642 (patch)
tree7e67a45b8fdb7eeda615b6564bb516d402e04d00 /org.eclipse.jgit.junit/src
parentcb208fb3ca130a2241bef3f3a33d54269d3a14ba (diff)
parenta80df5380f6f94a8fccaaecac673e3ec9c29bb89 (diff)
downloadjgit-f78446b56fb27626b933f3c10e121b28a24fa642.tar.gz
jgit-f78446b56fb27626b933f3c10e121b28a24fa642.zip
Merge "RevWalk: Traverse all parents of UNINTERESTING commits"
Diffstat (limited to 'org.eclipse.jgit.junit/src')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java39
1 files changed, 38 insertions, 1 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
index e89cf0fb83..362007a982 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
@@ -361,6 +361,21 @@ public class TestRepository<R extends Repository> implements AutoCloseable {
}
/**
+ * Create a new, unparsed commit.
+ * <p>
+ * See {@link #unparsedCommit(int, RevTree, ObjectId...)}. The tree is the
+ * empty tree (no files or subdirectories).
+ *
+ * @param parents
+ * zero or more IDs of the commit's parents.
+ * @return the ID of the new commit.
+ * @throws Exception
+ */
+ public ObjectId unparsedCommit(ObjectId... parents) throws Exception {
+ return unparsedCommit(1, tree(), parents);
+ }
+
+ /**
* Create a new commit.
* <p>
* See {@link #commit(int, RevTree, RevCommit...)}. The tree is the empty
@@ -428,6 +443,28 @@ public class TestRepository<R extends Repository> implements AutoCloseable {
*/
public RevCommit commit(final int secDelta, final RevTree tree,
final RevCommit... parents) throws Exception {
+ ObjectId id = unparsedCommit(secDelta, tree, parents);
+ return pool.parseCommit(id);
+ }
+
+ /**
+ * Create a new, unparsed commit.
+ * <p>
+ * The author and committer identities are stored using the current
+ * timestamp, after being incremented by {@code secDelta}. The message body
+ * is empty.
+ *
+ * @param secDelta
+ * number of seconds to advance {@link #tick(int)} by.
+ * @param tree
+ * the root tree for the commit.
+ * @param parents
+ * zero or more IDs of the commit's parents.
+ * @return the ID of the new commit.
+ * @throws Exception
+ */
+ public ObjectId unparsedCommit(final int secDelta, final RevTree tree,
+ final ObjectId... parents) throws Exception {
tick(secDelta);
final org.eclipse.jgit.lib.CommitBuilder c;
@@ -443,7 +480,7 @@ public class TestRepository<R extends Repository> implements AutoCloseable {
id = ins.insert(c);
ins.flush();
}
- return pool.parseCommit(id);
+ return id;
}
/**