Merge changes from topics "jgit-reachability", "reachability-2"
* changes:
VisibilityChecker: Remove topoSort argument
VisibilityCache: Use jgit's ReachabilityChecker
diff --git a/WORKSPACE b/WORKSPACE
index 9b003bc..afff638 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -164,7 +164,7 @@
sha1 = "198ea005f41219f038f4291f0b0e9f3259730e92",
)
-JGIT_VERS = "5.4.3.201909031940-r"
+JGIT_VERS = "5.5.1.201910021850-r"
JGIT_REPO = MAVEN_CENTRAL
@@ -172,28 +172,28 @@
name = "jgit-lib",
artifact = "org.eclipse.jgit:org.eclipse.jgit:" + JGIT_VERS,
repository = JGIT_REPO,
- sha1 = "10322c4e103485f8b4873cbbf982342f9c3d7989",
+ sha1 = "e0ba7a468e8c62da8521ca3a06a061d4dde95223",
)
maven_jar(
name = "jgit-servlet",
artifact = "org.eclipse.jgit:org.eclipse.jgit.http.server:" + JGIT_VERS,
repository = JGIT_REPO,
- sha1 = "59d0c943343f30612e4e2a5a3bf1b95b56e00207",
+ sha1 = "dde1857a91504fadda0af4bb8958d11cfb14dcfe",
)
maven_jar(
name = "jgit-junit",
artifact = "org.eclipse.jgit:org.eclipse.jgit.junit:" + JGIT_VERS,
repository = JGIT_REPO,
- sha1 = "71659fc1a1729b7c67846dac8cd6a762fa72002a",
+ sha1 = "894f85c1615d1b47def1018bd98ca65dcaf5a8d5",
)
maven_jar(
name = "jgit-archive",
artifact = "org.eclipse.jgit:org.eclipse.jgit.archive:" + JGIT_VERS,
repository = JGIT_REPO,
- sha1 = "21dc4a10882dc667c83bf82a563a6fc4d7719456",
+ sha1 = "1dd6de0d52ad3055cee6ba9b34764b08d85a5238",
)
maven_jar(
diff --git a/java/com/google/gitiles/LogServlet.java b/java/com/google/gitiles/LogServlet.java
index 4d038ae..c738f0e 100644
--- a/java/com/google/gitiles/LogServlet.java
+++ b/java/com/google/gitiles/LogServlet.java
@@ -71,6 +71,9 @@
private static final String FOLLOW_PARAM = "follow";
private static final String NAME_STATUS_PARAM = "name-status";
private static final String PRETTY_PARAM = "pretty";
+ private static final String TOPO_ORDER_PARAM = "topo-order";
+ private static final String REVERSE_PARAM = "reverse";
+ private static final String FIRST_PARENT_PARAM = "first-parent";
private static final int DEFAULT_LIMIT = 100;
private static final int MAX_LIMIT = 10000;
@@ -223,6 +226,15 @@
private static RevWalk newWalk(Repository repo, GitilesView view, GitilesAccess access)
throws MissingObjectException, IOException {
RevWalk walk = new RevWalk(repo);
+ if (isTrue(view, FIRST_PARENT_PARAM)) {
+ walk.setFirstParent(true);
+ }
+ if (isTrue(view, TOPO_ORDER_PARAM)) {
+ walk.sort(RevSort.TOPO, true);
+ }
+ if (isTrue(view, REVERSE_PARAM)) {
+ walk.sort(RevSort.REVERSE, true);
+ }
try {
walk.markStart(walk.parseCommit(view.getRevision().getId()));
if (!Revision.isNull(view.getOldRevision())) {
@@ -233,12 +245,6 @@
}
setTreeFilter(walk, view, access);
setRevFilter(walk, view);
- if (isTrue(view, "topo-order")) {
- walk.sort(RevSort.TOPO, true);
- }
- if (isTrue(view, "reverse")) {
- walk.sort(RevSort.REVERSE, true);
- }
return walk;
}
diff --git a/javatests/com/google/gitiles/LogServletTest.java b/javatests/com/google/gitiles/LogServletTest.java
index 06ddaf4..7232439 100644
--- a/javatests/com/google/gitiles/LogServletTest.java
+++ b/javatests/com/google/gitiles/LogServletTest.java
@@ -67,6 +67,19 @@
}
@Test
+ public void firstParentLog() throws Exception {
+ RevCommit p1 = repo.update("master", repo.commit().add("foo", "foo\n"));
+ RevCommit p2 = repo.update("master", repo.commit().add("foo", "foo2\n"));
+ RevCommit c = repo.update("master", repo.commit().parent(p1).parent(p2).add("foo", "foo3\n"));
+
+ Log response = buildJson(LOG, "/repo/+log/master", "first-parent");
+ assertThat(response.log).hasSize(2);
+
+ verifyJsonCommit(response.log.get(0), c);
+ verifyJsonCommit(response.log.get(1), p1);
+ }
+
+ @Test
public void follow() throws Exception {
String contents = "contents";
RevCommit c1 = repo.branch("master").commit().add("foo", contents).create();