The Unified and Autonomous Development Platform
Organize dependencies in POM
Robin Shenc26656ad7e3f
diff --git a/core/pom.xml b/core/pom.xmlindex c638b2240c..8a29cbb50f 100644--- a/core/pom.xml+++ b/core/pom.xml@@ -1,5 +1,6 @@<?xml version="1.0" encoding="UTF-8"?>-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"+<project xmlns="http://maven.apache.org/POM/4.0.0"+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><artifactId>server-core</artifactId>@@ -21,6 +22,148 @@</plugins></build><dependencies>+ <dependency>+ <groupId>io.onedev</groupId>+ <artifactId>launcher-loader</artifactId>+ <version>${launcher.version}</version>+ </dependency>+ <dependency>+ <groupId>io.onedev</groupId>+ <artifactId>launcher-loader</artifactId>+ <version>${launcher.version}</version>+ <type>test-jar</type>+ <scope>test</scope>+ </dependency>+ <dependency>+ <groupId>commons-codec</groupId>+ <artifactId>commons-codec</artifactId>+ <version>1.7</version>+ </dependency>+ <dependency>+ <groupId>org.apache.commons</groupId>+ <artifactId>commons-compress</artifactId>+ <version>1.18</version>+ </dependency>+ <dependency>+ <groupId>org.jetbrains.xodus</groupId>+ <artifactId>xodus-entity-store</artifactId>+ <version>1.2.3</version>+ </dependency>+ <dependency>+ <groupId>org.apache.tika</groupId>+ <artifactId>tika-core</artifactId>+ <version>1.19.1</version>+ </dependency>+ <dependency>+ <groupId>com.google.guava</groupId>+ <artifactId>guava</artifactId>+ <version>20.0</version>+ </dependency>+ <dependency>+ <groupId>org.apache.commons</groupId>+ <artifactId>commons-email</artifactId>+ <version>1.4</version>+ </dependency>+ <dependency>+ <groupId>org.jsoup</groupId>+ <artifactId>jsoup</artifactId>+ <version>1.8.1</version>+ </dependency>+ <dependency>+ <groupId>org.apache.velocity</groupId>+ <artifactId>velocity</artifactId>+ <version>1.7</version>+ </dependency>+ <dependency>+ <groupId>commons-httpclient</groupId>+ <artifactId>commons-httpclient</artifactId>+ <version>3.1</version>+ </dependency>+ <dependency>+ <groupId>joda-time</groupId>+ <artifactId>joda-time</artifactId>+ <version>2.2</version>+ </dependency>+ <dependency>+ <groupId>org.javassist</groupId>+ <artifactId>javassist</artifactId>+ <version>3.20.0-GA</version>+ </dependency>+ <dependency>+ <groupId>org.eclipse.jetty</groupId>+ <artifactId>jetty-server</artifactId>+ <version>${jetty.version}</version>+ </dependency>+ <dependency>+ <groupId>org.eclipse.jetty</groupId>+ <artifactId>jetty-servlets</artifactId>+ <version>${jetty.version}</version>+ </dependency>+ <dependency>+ <groupId>org.eclipse.jetty</groupId>+ <artifactId>jetty-servlet</artifactId>+ <version>${jetty.version}</version>+ </dependency>+ <dependency>+ <groupId>org.eclipse.jetty.websocket</groupId>+ <artifactId>websocket-server</artifactId>+ <version>${jetty.version}</version>+ </dependency>+ <dependency>+ <groupId>com.fasterxml.jackson.core</groupId>+ <artifactId>jackson-core</artifactId>+ <version>${jackson.version}</version>+ </dependency>+ <dependency>+ <groupId>com.fasterxml.jackson.core</groupId>+ <artifactId>jackson-databind</artifactId>+ <version>${jackson.version}</version>+ </dependency>+ <dependency>+ <groupId>com.fasterxml.jackson.datatype</groupId>+ <artifactId>jackson-datatype-guava</artifactId>+ <version>${jackson.version}</version>+ </dependency>+ <dependency>+ <groupId>com.fasterxml.jackson.datatype</groupId>+ <artifactId>jackson-datatype-joda</artifactId>+ <version>${jackson.version}</version>+ </dependency>+ <dependency>+ <groupId>com.fasterxml.jackson.jaxrs</groupId>+ <artifactId>jackson-jaxrs-json-provider</artifactId>+ <version>${jackson.version}</version>+ </dependency>+ <dependency>+ <groupId>org.glassfish.jersey.containers</groupId>+ <artifactId>jersey-container-servlet</artifactId>+ <version>${jersey.version}</version>+ </dependency>+ <dependency>+ <groupId>org.glassfish.jersey.core</groupId>+ <artifactId>jersey-client</artifactId>+ <version>${jersey.version}</version>+ </dependency>+ <dependency>+ <groupId>org.glassfish.jersey.ext</groupId>+ <artifactId>jersey-bean-validation</artifactId>+ <version>${jersey.version}</version>+ </dependency>+ <dependency>+ <groupId>org.hibernate</groupId>+ <artifactId>hibernate-validator</artifactId>+ <version>5.2.4.Final</version>+ </dependency>+ <dependency>+ <groupId>org.reflections</groupId>+ <artifactId>reflections</artifactId>+ <version>0.9.9</version>+ </dependency>+ <dependency>+ <groupId>org.unbescape</groupId>+ <artifactId>unbescape</artifactId>+ <version>1.1.2.RELEASE</version>+ </dependency><dependency><groupId>org.apache.wicket</groupId><artifactId>wicket-core</artifactId>@@ -92,28 +235,21 @@<artifactId>prettytime</artifactId><version>4.0.1.Final</version></dependency>+ <dependency>+ <groupId>org.apache.httpcomponents</groupId>+ <artifactId>httpclient</artifactId>+ <version>4.5.6</version>+ </dependency><dependency><groupId>io.onedev</groupId><artifactId>codeassist</artifactId><version>1.0.1</version></dependency>- <dependency>- <groupId>org.glassfish.jersey.containers</groupId>- <artifactId>jersey-container-servlet</artifactId>- </dependency>- <dependency>- <groupId>org.glassfish.jersey.ext</groupId>- <artifactId>jersey-bean-validation</artifactId>- </dependency><dependency><groupId>org.glassfish.hk2</groupId><artifactId>guice-bridge</artifactId><version>2.4.0-b06</version></dependency>- <dependency>- <groupId>org.jetbrains.xodus</groupId>- <artifactId>xodus-entity-store</artifactId>- </dependency><dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-core</artifactId>@@ -246,7 +382,7 @@<dependency><groupId>org.dom4j</groupId><artifactId>dom4j</artifactId>- <version>2.0.0</version>+ <version>2.1.1</version></dependency><dependency><groupId>com.thoughtworks.xstream</groupId>@@ -263,47 +399,11 @@<artifactId>groovy</artifactId><version>${groovy.version}</version></dependency>- <dependency>- <groupId>commons-codec</groupId>- <artifactId>commons-codec</artifactId>- </dependency>- <dependency>- <groupId>javax.servlet</groupId>- <artifactId>javax.servlet-api</artifactId>- </dependency>- <dependency>- <groupId>org.unbescape</groupId>- <artifactId>unbescape</artifactId>- </dependency>- <dependency>- <groupId>commons-httpclient</groupId>- <artifactId>commons-httpclient</artifactId>- </dependency>- <dependency>- <groupId>joda-time</groupId>- <artifactId>joda-time</artifactId>- </dependency>- <dependency>- <groupId>org.jsoup</groupId>- <artifactId>jsoup</artifactId>- </dependency>- <dependency>- <groupId>org.apache.commons</groupId>- <artifactId>commons-email</artifactId>- </dependency>- <dependency>- <groupId>org.javassist</groupId>- <artifactId>javassist</artifactId>- </dependency><dependency><groupId>com.googlecode.juniversalchardet</groupId><artifactId>juniversalchardet</artifactId><version>1.0.3</version></dependency>- <dependency>- <groupId>org.apache.tika</groupId>- <artifactId>tika-core</artifactId>- </dependency><dependency><groupId>io.onedev</groupId><artifactId>jsymbol</artifactId>@@ -349,42 +449,6 @@<artifactId>flexmark-ext-toc</artifactId><version>${flexmark.version}</version></dependency>- <dependency>- <groupId>com.fasterxml.jackson.core</groupId>- <artifactId>jackson-databind</artifactId>- </dependency>- <dependency>- <groupId>com.fasterxml.jackson.datatype</groupId>- <artifactId>jackson-datatype-guava</artifactId>- </dependency>- <dependency>- <groupId>com.fasterxml.jackson.datatype</groupId>- <artifactId>jackson-datatype-joda</artifactId>- </dependency>- <dependency>- <groupId>com.fasterxml.jackson.jaxrs</groupId>- <artifactId>jackson-jaxrs-json-provider</artifactId>- </dependency>- <dependency>- <groupId>org.hibernate</groupId>- <artifactId>hibernate-validator</artifactId>- </dependency>- <dependency>- <groupId>org.eclipse.jetty</groupId>- <artifactId>jetty-server</artifactId>- </dependency>- <dependency>- <groupId>org.eclipse.jetty</groupId>- <artifactId>jetty-servlets</artifactId>- </dependency>- <dependency>- <groupId>org.eclipse.jetty</groupId>- <artifactId>jetty-servlet</artifactId>- </dependency>- <dependency>- <groupId>org.eclipse.jetty.websocket</groupId>- <artifactId>websocket-server</artifactId>- </dependency><dependency><groupId>org.eclipse.jgit</groupId><artifactId>org.eclipse.jgit.http.server</artifactId>@@ -401,10 +465,16 @@<lucene.version>4.10.3</lucene.version><hibernate.version>5.2.10.Final</hibernate.version><shiro.version>1.4.0</shiro.version>- <jgit.version>4.7.0.201704051617-r</jgit.version>+ <jgit.version>5.1.3.201810200350-r</jgit.version><flexmark.version>0.18.3</flexmark.version><groovy.version>2.4.14</groovy.version><wicket.version>7.10.0</wicket.version><wicketbootstrap.version>0.10.17</wicketbootstrap.version>+ <launcher.version>1.0.2</launcher.version>+ <jersey.version>2.13</jersey.version>+ <jetty.version>9.3.24.v20180605</jetty.version>+ <jackson.version>2.4.3</jackson.version>+ <servlet.version>3.1.0</servlet.version>+ <antlr.version>4.5.1-1</antlr.version></properties></project>diff --git a/core/src/main/java/io/onedev/server/git/BlameCommit.java b/core/src/main/java/io/onedev/server/git/BlameCommit.javaindex d8da07ff2c..240ce6ed3d 100644--- a/core/src/main/java/io/onedev/server/git/BlameCommit.java+++ b/core/src/main/java/io/onedev/server/git/BlameCommit.java@@ -7,6 +7,7 @@ import java.util.Date;import org.eclipse.jgit.lib.PersonIdent;+import com.google.common.base.MoreObjects;import com.google.common.base.Objects;public class BlameCommit implements Serializable {@@ -62,10 +63,9 @@ public class BlameCommit implements Serializable {return Objects.equal(hash, rhs.hash);}- @SuppressWarnings("deprecation")@Overridepublic String toString() {- return Objects.toStringHelper(this)+ return MoreObjects.toStringHelper(this).add("hash", hash).add("committer", committer.getName()).add("date", committer.getWhen())diff --git a/core/src/main/java/io/onedev/server/git/BlobIdent.java b/core/src/main/java/io/onedev/server/git/BlobIdent.javaindex 253ab22591..27c056bc1a 100644--- a/core/src/main/java/io/onedev/server/git/BlobIdent.java+++ b/core/src/main/java/io/onedev/server/git/BlobIdent.java@@ -9,7 +9,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;import org.apache.commons.lang3.builder.HashCodeBuilder;import org.eclipse.jgit.lib.FileMode;-import com.google.common.base.Objects;+import com.google.common.base.MoreObjects;import io.onedev.server.git.exception.ObjectNotFoundException;import io.onedev.server.model.Project;@@ -119,10 +119,9 @@ public class BlobIdent implements Serializable, Comparable<BlobIdent> {.toHashCode();}- @SuppressWarnings("deprecation")@Overridepublic String toString() {- return Objects.toStringHelper(BlobIdent.class)+ return MoreObjects.toStringHelper(BlobIdent.class).add("revision", revision).add("path", path).omitNullValues()diff --git a/core/src/main/java/io/onedev/server/manager/impl/DefaultCommitInfoManager.java b/core/src/main/java/io/onedev/server/manager/impl/DefaultCommitInfoManager.javaindex 19b954c190..d2ff10a847 100644--- a/core/src/main/java/io/onedev/server/manager/impl/DefaultCommitInfoManager.java+++ b/core/src/main/java/io/onedev/server/manager/impl/DefaultCommitInfoManager.java@@ -73,6 +73,7 @@ import jetbrains.exodus.ArrayByteIterable;import jetbrains.exodus.ByteIterable;import jetbrains.exodus.backup.BackupStrategy;import jetbrains.exodus.backup.BackupStrategy.FileDescriptor;+import jetbrains.exodus.backup.VirtualFileDescriptor;import jetbrains.exodus.env.Environment;import jetbrains.exodus.env.Store;import jetbrains.exodus.env.Transaction;@@ -987,8 +988,8 @@ public class DefaultCommitInfoManager extends AbstractEnvironmentManager implemeList<CollectingWork> works = new ArrayList<>();try (RevWalk revWalk = new RevWalk(project.getRepository())) {Collection<Ref> refs = new ArrayList<>();- refs.addAll(project.getRepository().getRefDatabase().getRefs(Constants.R_HEADS).values());- refs.addAll(project.getRepository().getRefDatabase().getRefs(Constants.R_TAGS).values());+ refs.addAll(project.getRepository().getRefDatabase().getRefsByPrefix(Constants.R_HEADS));+ refs.addAll(project.getRepository().getRefDatabase().getRefsByPrefix(Constants.R_TAGS));for (Ref ref: refs) {RevObject revObj = revWalk.peel(revWalk.parseAny(ref.getObjectId()));@@ -1089,8 +1090,8 @@ public class DefaultCommitInfoManager extends AbstractEnvironmentManager implemeFile targetDir = getEnvDir(target.getId().toString());backupStrategy.beforeBackup();try {- for (FileDescriptor descriptor: backupStrategy.listFiles()) {- FileUtils.copyFileToDirectory(descriptor.getFile(), targetDir);+ for (VirtualFileDescriptor descriptor: backupStrategy.getContents()) {+ FileUtils.copyFileToDirectory(((FileDescriptor)descriptor).getFile(), targetDir);}} finally {backupStrategy.afterBackup();diff --git a/core/src/main/java/io/onedev/server/model/Project.java b/core/src/main/java/io/onedev/server/model/Project.javaindex c240975353..c95659b94a 100644--- a/core/src/main/java/io/onedev/server/model/Project.java+++ b/core/src/main/java/io/onedev/server/model/Project.java@@ -407,7 +407,7 @@ public class Project extends AbstractEntity {public List<RefInfo> getRefInfos(String prefix) {try (RevWalk revWalk = new RevWalk(getRepository())) {- List<Ref> refs = new ArrayList<Ref>(getRepository().getRefDatabase().getRefs(prefix).values());+ List<Ref> refs = new ArrayList<Ref>(getRepository().getRefDatabase().getRefsByPrefix(prefix));List<RefInfo> refInfos = refs.stream().map(ref->new RefInfo(revWalk, ref)).filter(refInfo->refInfo.getPeeledObj() instanceof RevCommit)@@ -757,9 +757,9 @@ public class Project extends AbstractEntity {return getRevCommit(revId, true);}- public Map<String, Ref> getRefs(String prefix) {+ public List<Ref> getRefs(String prefix) {try {- return getRepository().getRefDatabase().getRefs(prefix);+ return getRepository().getRefDatabase().getRefsByPrefix(prefix);} catch (IOException e) {throw new RuntimeException(e);}@@ -1205,7 +1205,7 @@ public class Project extends AbstractEntity {if (lastCommitOptional == null) {RevCommit lastCommit = null;try {- for (Ref ref: getRepository().getRefDatabase().getRefs(Constants.R_HEADS).values()) {+ for (Ref ref: getRepository().getRefDatabase().getRefsByPrefix(Constants.R_HEADS)) {RevCommit commit = getRevCommit(ref.getObjectId(), false);if (commit != null) {if (lastCommit != null) {diff --git a/core/src/main/java/io/onedev/server/model/User.java b/core/src/main/java/io/onedev/server/model/User.javaindex 388bbfca2f..3cdae248f8 100644--- a/core/src/main/java/io/onedev/server/model/User.java+++ b/core/src/main/java/io/onedev/server/model/User.java@@ -26,7 +26,7 @@ import org.hibernate.validator.constraints.Email;import org.hibernate.validator.constraints.NotEmpty;import com.fasterxml.jackson.annotation.JsonView;-import com.google.common.base.Objects;+import com.google.common.base.MoreObjects;import com.google.common.base.Preconditions;import io.onedev.launcher.loader.AppLoader;@@ -190,10 +190,9 @@ public class User extends AbstractEntity implements AuthenticationInfo {this.memberships = memberships;}- @SuppressWarnings("deprecation")@Overridepublic String toString() {- return Objects.toStringHelper(this)+ return MoreObjects.toStringHelper(this).add("name", getName()).toString();}diff --git a/core/src/main/java/io/onedev/server/web/behavior/sortable/SortPosition.java b/core/src/main/java/io/onedev/server/web/behavior/sortable/SortPosition.javaindex 7c310f13b4..0754a280da 100644--- a/core/src/main/java/io/onedev/server/web/behavior/sortable/SortPosition.java+++ b/core/src/main/java/io/onedev/server/web/behavior/sortable/SortPosition.java@@ -1,6 +1,6 @@package io.onedev.server.web.behavior.sortable;-import com.google.common.base.Objects;+import com.google.common.base.MoreObjects;public class SortPosition {@@ -21,10 +21,9 @@ public class SortPosition {return itemIndex;}- @SuppressWarnings("deprecation")@Overridepublic String toString() {- return Objects.toStringHelper(this)+ return MoreObjects.toStringHelper(this).add("listIndex", listIndex).add("itemIndex", itemIndex).toString();diff --git a/core/src/main/java/io/onedev/server/web/page/project/branches/ProjectBranchesPage.java b/core/src/main/java/io/onedev/server/web/page/project/branches/ProjectBranchesPage.javaindex 7c2afbed4f..7ed2b4414d 100644--- a/core/src/main/java/io/onedev/server/web/page/project/branches/ProjectBranchesPage.java+++ b/core/src/main/java/io/onedev/server/web/page/project/branches/ProjectBranchesPage.java@@ -145,8 +145,7 @@ public class ProjectBranchesPage extends ProjectPage {compareIds.add(ref.getRef().getObjectId());}- Ref baseRef = getProject().getRefs(Constants.R_HEADS).get(baseBranch);- Preconditions.checkNotNull(baseRef);+ Ref baseRef = Preconditions.checkNotNull(getProject().getBranchRef(baseBranch));Map<ObjectId, AheadBehind> aheadBehinds = new HashMap<>();try (RevWalk revWalk = new RevWalk(getProject().getRepository())) {diff --git a/core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.html b/core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.htmlindex 6db5f5eed0..beb6589fdb 100644--- a/core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.html+++ b/core/src/main/java/io/onedev/server/web/page/project/compare/RevisionComparePage.html@@ -4,9 +4,9 @@<tr><td class="left revision"><div class="title clearfix">- <label class="pull-left">Left side</label>+ <label class="pull-left">Base</label><wicket:enclosure child="compareWithMergeBase">- <input wicket:id="compareWithMergeBase" type="checkbox" class="pull-left"></input>+ <input wicket:id="compareWithMergeBase" type="checkbox" class="pull-left"><span class="pull-left">common ancestor</span><span wicket:id="mergeBaseTooltip" class="pull-left"><i class="fa fa-question-circle"></i></span></wicket:enclosure>@@ -21,7 +21,7 @@</td><td class="right revision"><div class="title">- <label>Right side</label>+ <label>Compare</label></div><div wicket:id="rightRevSelector" class="selector"></div><div class="message">@@ -38,7 +38,7 @@</div><div wicket:id="unrelatedHistory" class="alert alert-danger"><span class="fa fa-lg fa-warning"></span>- <span>History of left side and right side is unrelated.</span>+ <span>History of comparing revisions is unrelated.</span></div><ul wicket:id="tabs" class="nav nav-tabs"></ul><div wicket:id="tabPanel" class="tab-panel"></div>diff --git a/core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/mergepreview/MergePreviewPage.html b/core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/mergepreview/MergePreviewPage.htmlindex 852d6b279d..619060fed2 100644--- a/core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/mergepreview/MergePreviewPage.html+++ b/core/src/main/java/io/onedev/server/web/page/project/pullrequests/detail/mergepreview/MergePreviewPage.html@@ -4,7 +4,7 @@<div class="available"><div class="commits clearfix"><div class="commit pull-left">- <div class="title">Left Side</div>+ <div class="title">Base</div><span class="btn-group"><a wicket:id="targetHead" class="hash btn btn-sm btn-default"><span wicket:id="hash"></span></a><a wicket:id="copyTargetHead" class="btn btn-sm btn-default"><i class="fa fa-clipboard"></i></a>@@ -13,7 +13,7 @@</div><div class="vs pull-left">VS</div><div class="commit pull-left">- <div class="title">Right Side</div>+ <div class="title">Compare</div><span class="btn-group"><a wicket:id="mergedCommit" class="hash btn btn-sm btn-default"><span wicket:id="hash"></span></a><a wicket:id="copyMergedCommit" class="btn btn-sm btn-default"><i class="fa fa-clipboard"></i></a>diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/AbstractRevQueue.java b/core/src/main/java/org/eclipse/jgit/revwalk/AbstractRevQueue.javaindex 4923d0f741..247a3bdb28 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/AbstractRevQueue.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/AbstractRevQueue.java@@ -74,7 +74,7 @@ abstract class AbstractRevQueue extends Generator {* @param queueControl* flag that controls admission to the queue.*/- public final void add(final RevCommit c, final RevFlag queueControl) {+ public final void add(RevCommit c, RevFlag queueControl) {if (!c.has(queueControl)) {c.add(queueControl);add(c);@@ -94,7 +94,7 @@ abstract class AbstractRevQueue extends Generator {* @param queueControl* flag that controls admission to the queue.*/- public final void addParents(final RevCommit c, final RevFlag queueControl) {+ public final void addParents(RevCommit c, RevFlag queueControl) {final RevCommit[] pList = c.parents;if (pList == null)return;@@ -103,14 +103,16 @@ abstract class AbstractRevQueue extends Generator {}/**+ * {@inheritDoc}+ * <p>* Remove the first commit from the queue.- *- * @return the first commit of this queue.*/@Overridepublic abstract RevCommit next();- /** Remove all entries from this queue. */+ /**+ * Remove all entries from this queue.+ */public abstract void clear();abstract boolean everbodyHasFlag(int f);@@ -122,7 +124,15 @@ abstract class AbstractRevQueue extends Generator {return outputType;}- protected static void describe(final StringBuilder s, final RevCommit c) {+ /**+ * Describe this queue+ *+ * @param s+ * a StringBuilder+ * @param c+ * a {@link org.eclipse.jgit.revwalk.RevCommit}+ */+ protected static void describe(StringBuilder s, RevCommit c) {s.append(c.toString());s.append('\n');}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/AsyncRevObjectQueue.java b/core/src/main/java/org/eclipse/jgit/revwalk/AsyncRevObjectQueue.javaindex 1c0438a5ed..d263184622 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/AsyncRevObjectQueue.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/AsyncRevObjectQueue.java@@ -59,11 +59,11 @@ public interface AsyncRevObjectQueue extends AsyncOperation {* Obtain the next object.** @return the object; null if there are no more objects remaining.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the object does not exist. There may be more objects* remaining in the iteration, the application should call* {@link #next()} again.- * @throws IOException+ * @throws java.io.IOException* the object store cannot be accessed.*/public RevObject next() throws MissingObjectException, IOException;diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/BitmapWalker.java b/core/src/main/java/org/eclipse/jgit/revwalk/BitmapWalker.javanew file mode 100644index 0000000000..b07de5f1f6--- /dev/null+++ b/core/src/main/java/org/eclipse/jgit/revwalk/BitmapWalker.java@@ -0,0 +1,254 @@+/*+ * Copyright (C) 2012, Google Inc.+ * and other copyright owners as documented in the project's IP log.+ *+ * This program and the accompanying materials are made available+ * under the terms of the Eclipse Distribution License v1.0 which+ * accompanies this distribution, is reproduced below, and is+ * available at http://www.eclipse.org/org/documents/edl-v10.php+ *+ * All rights reserved.+ *+ * Redistribution and use in source and binary forms, with or+ * without modification, are permitted provided that the following+ * conditions are met:+ *+ * - Redistributions of source code must retain the above copyright+ * notice, this list of conditions and the following disclaimer.+ *+ * - Redistributions in binary form must reproduce the above+ * copyright notice, this list of conditions and the following+ * disclaimer in the documentation and/or other materials provided+ * with the distribution.+ *+ * - Neither the name of the Eclipse Foundation, Inc. nor the+ * names of its contributors may be used to endorse or promote+ * products derived from this software without specific prior+ * written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+ */++package org.eclipse.jgit.revwalk;++import java.io.IOException;+import java.util.Arrays;++import org.eclipse.jgit.errors.IncorrectObjectTypeException;+import org.eclipse.jgit.errors.MissingObjectException;+import org.eclipse.jgit.internal.revwalk.AddToBitmapFilter;+import org.eclipse.jgit.internal.revwalk.AddUnseenToBitmapFilter;+import org.eclipse.jgit.lib.AnyObjectId;+import org.eclipse.jgit.lib.BitmapIndex;+import org.eclipse.jgit.lib.BitmapIndex.Bitmap;+import org.eclipse.jgit.lib.BitmapIndex.BitmapBuilder;+import org.eclipse.jgit.lib.NullProgressMonitor;+import org.eclipse.jgit.lib.ObjectId;+import org.eclipse.jgit.lib.ProgressMonitor;+import org.eclipse.jgit.revwalk.filter.ObjectFilter;++/**+ * Helper class to do ObjectWalks with pack index bitmaps.+ *+ * @since 4.10+ */+public final class BitmapWalker {++ private final ObjectWalk walker;++ private final BitmapIndex bitmapIndex;++ private final ProgressMonitor pm;++ private long countOfBitmapIndexMisses;++ /**+ * Create a BitmapWalker.+ *+ * @param walker walker to use when traversing the object graph.+ * @param bitmapIndex index to obtain bitmaps from.+ * @param pm progress monitor to report progress on.+ */+ public BitmapWalker(+ ObjectWalk walker, BitmapIndex bitmapIndex, ProgressMonitor pm) {+ this.walker = walker;+ this.bitmapIndex = bitmapIndex;+ this.pm = (pm == null) ? NullProgressMonitor.INSTANCE : pm;+ }++ /**+ * Return the number of objects that had to be walked because they were not covered by a+ * bitmap.+ *+ * @return the number of objects that had to be walked because they were not covered by a+ * bitmap.+ */+ public long getCountOfBitmapIndexMisses() {+ return countOfBitmapIndexMisses;+ }++ /**+ * Return, as a bitmap, the objects reachable from the objects in start.+ *+ * @param start+ * the objects to start the object traversal from.+ * @param seen+ * the objects to skip if encountered during traversal.+ * @param ignoreMissing+ * true to ignore missing objects, false otherwise.+ * @return as a bitmap, the objects reachable from the objects in start.+ * @throws org.eclipse.jgit.errors.MissingObjectException+ * the object supplied is not available from the object+ * database. This usually indicates the supplied object is+ * invalid, but the reference was constructed during an earlier+ * invocation to+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}.+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException+ * the object was not parsed yet and it was discovered during+ * parsing that it is not actually the type of the instance+ * passed in. This usually indicates the caller used the wrong+ * type in a+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}+ * call.+ * @throws java.io.IOException+ * a pack file or loose object could not be read.+ */+ public BitmapBuilder findObjects(Iterable<? extends ObjectId> start, BitmapBuilder seen,+ boolean ignoreMissing)+ throws MissingObjectException, IncorrectObjectTypeException,+ IOException {+ if (!ignoreMissing) {+ return findObjectsWalk(start, seen, false);+ }++ try {+ return findObjectsWalk(start, seen, true);+ } catch (MissingObjectException ignore) {+ // An object reachable from one of the "start"s is missing.+ // Walk from the "start"s one at a time so it can be excluded.+ }++ final BitmapBuilder result = bitmapIndex.newBitmapBuilder();+ for (ObjectId obj : start) {+ Bitmap bitmap = bitmapIndex.getBitmap(obj);+ if (bitmap != null) {+ result.or(bitmap);+ }+ }++ for (ObjectId obj : start) {+ if (result.contains(obj)) {+ continue;+ }+ try {+ result.or(findObjectsWalk(Arrays.asList(obj), result, false));+ } catch (MissingObjectException ignore) {+ // An object reachable from this "start" is missing.+ //+ // This can happen when the client specified a "have" line+ // pointing to an object that is present but unreachable:+ // "git prune" and "git fsck" only guarantee that the object+ // database will continue to contain all objects reachable+ // from a ref and does not guarantee connectivity for other+ // objects in the object database.+ //+ // In this situation, skip the relevant "start" and move on+ // to the next one.+ //+ // TODO(czhen): Make findObjectsWalk resume the walk instead+ // once RevWalk and ObjectWalk support that.+ }+ }+ return result;+ }++ private BitmapBuilder findObjectsWalk(Iterable<? extends ObjectId> start, BitmapBuilder seen,+ boolean ignoreMissingStart)+ throws MissingObjectException, IncorrectObjectTypeException,+ IOException {+ walker.reset();+ final BitmapBuilder bitmapResult = bitmapIndex.newBitmapBuilder();++ for (ObjectId obj : start) {+ Bitmap bitmap = bitmapIndex.getBitmap(obj);+ if (bitmap != null)+ bitmapResult.or(bitmap);+ }++ boolean marked = false;+ for (ObjectId obj : start) {+ try {+ if (!bitmapResult.contains(obj)) {+ walker.markStart(walker.parseAny(obj));+ marked = true;+ }+ } catch (MissingObjectException e) {+ if (ignoreMissingStart)+ continue;+ throw e;+ }+ }++ if (marked) {+ if (seen == null) {+ walker.setRevFilter(new AddToBitmapFilter(bitmapResult));+ } else {+ walker.setRevFilter(+ new AddUnseenToBitmapFilter(seen, bitmapResult));+ }+ walker.setObjectFilter(new BitmapObjectFilter(bitmapResult));++ while (walker.next() != null) {+ // Iterate through all of the commits. The BitmapRevFilter does+ // the work.+ //+ // filter.include returns true for commits that do not have+ // a bitmap in bitmapIndex and are not reachable from a+ // bitmap in bitmapIndex encountered earlier in the walk.+ // Thus the number of commits returned by next() measures how+ // much history was traversed without being able to make use+ // of bitmaps.+ pm.update(1);+ countOfBitmapIndexMisses++;+ }++ RevObject ro;+ while ((ro = walker.nextObject()) != null) {+ bitmapResult.addObject(ro, ro.getType());+ pm.update(1);+ }+ }++ return bitmapResult;+ }++ /**+ * Filter that excludes objects already in the given bitmap.+ */+ static class BitmapObjectFilter extends ObjectFilter {+ private final BitmapBuilder bitmap;++ BitmapObjectFilter(BitmapBuilder bitmap) {+ this.bitmap = bitmap;+ }++ @Override+ public final boolean include(ObjectWalk walker, AnyObjectId objid)+ throws MissingObjectException, IncorrectObjectTypeException,+ IOException {+ return !bitmap.contains(objid);+ }+ }+}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/BlockObjQueue.java b/core/src/main/java/org/eclipse/jgit/revwalk/BlockObjQueue.javaindex 371cd06dda..fcdf79520a 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/BlockObjQueue.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/BlockObjQueue.java@@ -55,7 +55,7 @@ class BlockObjQueue {free = new BlockFreeList();}- void add(final RevObject c) {+ void add(RevObject c) {Block b = tail;if (b == null) {b = free.newBlock();@@ -98,7 +98,7 @@ class BlockObjQueue {return b;}- void freeBlock(final Block b) {+ void freeBlock(Block b) {b.next = next;next = b;}@@ -127,7 +127,7 @@ class BlockObjQueue {return headIndex == tailIndex;}- void add(final RevObject c) {+ void add(RevObject c) {objects[tailIndex++] = c;}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/BlockRevQueue.java b/core/src/main/java/org/eclipse/jgit/revwalk/BlockRevQueue.javaindex db5379e507..79307b5b7c 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/BlockRevQueue.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/BlockRevQueue.java@@ -51,12 +51,14 @@ import org.eclipse.jgit.errors.MissingObjectException;abstract class BlockRevQueue extends AbstractRevQueue {protected BlockFreeList free;- /** Create an empty revision queue. */+ /**+ * Create an empty revision queue.+ */protected BlockRevQueue() {free = new BlockFreeList();}- BlockRevQueue(final Generator s) throws MissingObjectException,+ BlockRevQueue(Generator s) throws MissingObjectException,IncorrectObjectTypeException, IOException {free = new BlockFreeList();outputType = s.outputType();@@ -70,6 +72,8 @@ abstract class BlockRevQueue extends AbstractRevQueue {}/**+ * {@inheritDoc}+ * <p>* Reconfigure this queue to share the same free list as another.* <p>* Multiple revision queues can be connected to the same free list, making@@ -79,12 +83,9 @@ abstract class BlockRevQueue extends AbstractRevQueue {* <p>* Free lists are not thread-safe. Applications must ensure that all queues* sharing the same free list are doing so from only a single thread.- *- * @param q- * the other queue we will steal entries from.*/@Override- public void shareFreeList(final BlockRevQueue q) {+ public void shareFreeList(BlockRevQueue q) {free = q.free;}@@ -100,7 +101,7 @@ abstract class BlockRevQueue extends AbstractRevQueue {return b;}- void freeBlock(final Block b) {+ void freeBlock(Block b) {b.next = next;next = b;}@@ -137,11 +138,11 @@ abstract class BlockRevQueue extends AbstractRevQueue {return headIndex > 0;}- void add(final RevCommit c) {+ void add(RevCommit c) {commits[tailIndex++] = c;}- void unpop(final RevCommit c) {+ void unpop(RevCommit c) {commits[--headIndex] = c;}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/BoundaryGenerator.java b/core/src/main/java/org/eclipse/jgit/revwalk/BoundaryGenerator.javaindex 6be0c8584e..0fd6621e62 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/BoundaryGenerator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/BoundaryGenerator.java@@ -54,7 +54,7 @@ class BoundaryGenerator extends Generator {Generator g;- BoundaryGenerator(final RevWalk w, final Generator s) {+ BoundaryGenerator(RevWalk w, Generator s) {g = new InitialGenerator(w, s);}@@ -64,7 +64,7 @@ class BoundaryGenerator extends Generator {}@Override- void shareFreeList(final BlockRevQueue q) {+ void shareFreeList(BlockRevQueue q) {g.shareFreeList(q);}@@ -85,7 +85,7 @@ class BoundaryGenerator extends Generator {private final Generator source;- InitialGenerator(final RevWalk w, final Generator s) {+ InitialGenerator(RevWalk w, Generator s) {walk = w;held = new FIFORevQueue();source = s;@@ -98,7 +98,7 @@ class BoundaryGenerator extends Generator {}@Override- void shareFreeList(final BlockRevQueue q) {+ void shareFreeList(BlockRevQueue q) {q.shareFreeList(held);}@@ -107,7 +107,7 @@ class BoundaryGenerator extends Generator {IncorrectObjectTypeException, IOException {RevCommit c = source.next();if (c != null) {- for (final RevCommit p : c.parents)+ for (RevCommit p : c.parents)if ((p.flags & UNINTERESTING) != 0)held.add(p);return c;diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/DateRevQueue.java b/core/src/main/java/org/eclipse/jgit/revwalk/DateRevQueue.javaindex cd7c074cce..b86e876201 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/DateRevQueue.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/DateRevQueue.java@@ -49,7 +49,9 @@ import java.io.IOException;import org.eclipse.jgit.errors.IncorrectObjectTypeException;import org.eclipse.jgit.errors.MissingObjectException;-/** A queue of commits sorted by commit time order. */+/**+ * A queue of commits sorted by commit time order.+ */public class DateRevQueue extends AbstractRevQueue {private static final int REBUILD_INDEX_COUNT = 1000;@@ -67,12 +69,14 @@ public class DateRevQueue extends AbstractRevQueue {private int last = -1;- /** Create an empty date queue. */+ /**+ * Create an empty date queue.+ */public DateRevQueue() {super();}- DateRevQueue(final Generator s) throws MissingObjectException,+ DateRevQueue(Generator s) throws MissingObjectException,IncorrectObjectTypeException, IOException {for (;;) {final RevCommit c = s.next();@@ -82,8 +86,9 @@ public class DateRevQueue extends AbstractRevQueue {}}+ /** {@inheritDoc} */@Override- public void add(final RevCommit c) {+ public void add(RevCommit c) {sinceLastIndex++;if (++inQueue > REBUILD_INDEX_COUNT&& sinceLastIndex > REBUILD_INDEX_COUNT)@@ -127,6 +132,7 @@ public class DateRevQueue extends AbstractRevQueue {}}+ /** {@inheritDoc} */@Overridepublic RevCommit next() {final Entry q = head;@@ -163,6 +169,7 @@ public class DateRevQueue extends AbstractRevQueue {return head != null ? head.commit : null;}+ /** {@inheritDoc} */@Overridepublic void clear() {head = null;@@ -174,7 +181,7 @@ public class DateRevQueue extends AbstractRevQueue {}@Override- boolean everbodyHasFlag(final int f) {+ boolean everbodyHasFlag(int f) {for (Entry q = head; q != null; q = q.next) {if ((q.commit.flags & f) == 0)return false;@@ -183,7 +190,7 @@ public class DateRevQueue extends AbstractRevQueue {}@Override- boolean anybodyHasFlag(final int f) {+ boolean anybodyHasFlag(int f) {for (Entry q = head; q != null; q = q.next) {if ((q.commit.flags & f) != 0)return true;@@ -196,6 +203,7 @@ public class DateRevQueue extends AbstractRevQueue {return outputType | SORT_COMMIT_TIME_DESC;}+ /** {@inheritDoc} */@Overridepublic String toString() {final StringBuilder s = new StringBuilder();@@ -204,7 +212,7 @@ public class DateRevQueue extends AbstractRevQueue {return s.toString();}- private Entry newEntry(final RevCommit c) {+ private Entry newEntry(RevCommit c) {Entry r = free;if (r == null)r = new Entry();@@ -214,7 +222,7 @@ public class DateRevQueue extends AbstractRevQueue {return r;}- private void freeEntry(final Entry e) {+ private void freeEntry(Entry e) {e.next = free;free = e;}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/DelayRevQueue.java b/core/src/main/java/org/eclipse/jgit/revwalk/DelayRevQueue.javaindex 4a0d19d60d..c397a01317 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/DelayRevQueue.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/DelayRevQueue.java@@ -69,7 +69,7 @@ final class DelayRevQueue extends Generator {private int size;- DelayRevQueue(final Generator g) {+ DelayRevQueue(Generator g) {pending = g;delay = new FIFORevQueue();}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/DepthGenerator.java b/core/src/main/java/org/eclipse/jgit/revwalk/DepthGenerator.javaindex ad05186354..eaec305b47 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/DepthGenerator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/DepthGenerator.java@@ -113,7 +113,7 @@ class DepthGenerator extends Generator {}@Override- void shareFreeList(final BlockRevQueue q) {+ void shareFreeList(BlockRevQueue q) {pending.shareFreeList(q);}@@ -134,7 +134,7 @@ class DepthGenerator extends Generator {int newDepth = c.depth + 1;- for (final RevCommit p : c.parents) {+ for (RevCommit p : c.parents) {DepthWalk.Commit dp = (DepthWalk.Commit) p;// If no depth has been assigned to this commit, assigndiff --git a/core/src/main/java/org/eclipse/jgit/revwalk/DepthWalk.java b/core/src/main/java/org/eclipse/jgit/revwalk/DepthWalk.javaindex f932593e82..06a5272b98 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/DepthWalk.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/DepthWalk.java@@ -52,15 +52,30 @@ import org.eclipse.jgit.lib.AnyObjectId;import org.eclipse.jgit.lib.ObjectReader;import org.eclipse.jgit.lib.Repository;-/** Interface for revision walkers that perform depth filtering. */+/**+ * Interface for revision walkers that perform depth filtering.+ */public interface DepthWalk {- /** @return Depth to filter to. */+ /**+ * Get depth to filter to.+ *+ * @return Depth to filter to.+ */public int getDepth();/** @return flag marking commits that should become unshallow. */+ /**+ * Get flag marking commits that should become unshallow.+ *+ * @return flag marking commits that should become unshallow.+ */public RevFlag getUnshallowFlag();- /** @return flag marking commits that are interesting again. */+ /**+ * Get flag marking commits that are interesting again.+ *+ * @return flag marking commits that are interesting again.+ */public RevFlag getReinterestingFlag();/** RevCommit with a depth (in commits) from a root. */diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/FIFORevQueue.java b/core/src/main/java/org/eclipse/jgit/revwalk/FIFORevQueue.javaindex 14156042c8..cdb084c15e 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/FIFORevQueue.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/FIFORevQueue.java@@ -48,24 +48,29 @@ import java.io.IOException;import org.eclipse.jgit.errors.IncorrectObjectTypeException;import org.eclipse.jgit.errors.MissingObjectException;-/** A queue of commits in FIFO order. */+/**+ * A queue of commits in FIFO order.+ */public class FIFORevQueue extends BlockRevQueue {private Block head;private Block tail;- /** Create an empty FIFO queue. */+ /**+ * Create an empty FIFO queue.+ */public FIFORevQueue() {super();}- FIFORevQueue(final Generator s) throws MissingObjectException,+ FIFORevQueue(Generator s) throws MissingObjectException,IncorrectObjectTypeException, IOException {super(s);}+ /** {@inheritDoc} */@Override- public void add(final RevCommit c) {+ public void add(RevCommit c) {Block b = tail;if (b == null) {b = free.newBlock();@@ -87,7 +92,7 @@ public class FIFORevQueue extends BlockRevQueue {* @param c* the commit to insert into the queue.*/- public void unpop(final RevCommit c) {+ public void unpop(RevCommit c) {Block b = head;if (b == null) {b = free.newBlock();@@ -108,6 +113,7 @@ public class FIFORevQueue extends BlockRevQueue {head = b;}+ /** {@inheritDoc} */@Overridepublic RevCommit next() {final Block b = head;@@ -124,6 +130,7 @@ public class FIFORevQueue extends BlockRevQueue {return c;}+ /** {@inheritDoc} */@Overridepublic void clear() {head = null;@@ -132,7 +139,7 @@ public class FIFORevQueue extends BlockRevQueue {}@Override- boolean everbodyHasFlag(final int f) {+ boolean everbodyHasFlag(int f) {for (Block b = head; b != null; b = b.next) {for (int i = b.headIndex; i < b.tailIndex; i++)if ((b.commits[i].flags & f) == 0)@@ -142,7 +149,7 @@ public class FIFORevQueue extends BlockRevQueue {}@Override- boolean anybodyHasFlag(final int f) {+ boolean anybodyHasFlag(int f) {for (Block b = head; b != null; b = b.next) {for (int i = b.headIndex; i < b.tailIndex; i++)if ((b.commits[i].flags & f) != 0)@@ -151,7 +158,7 @@ public class FIFORevQueue extends BlockRevQueue {return false;}- void removeFlag(final int f) {+ void removeFlag(int f) {final int not_f = ~f;for (Block b = head; b != null; b = b.next) {for (int i = b.headIndex; i < b.tailIndex; i++)@@ -159,6 +166,7 @@ public class FIFORevQueue extends BlockRevQueue {}}+ /** {@inheritDoc} */@Overridepublic String toString() {final StringBuilder s = new StringBuilder();diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/FixUninterestingGenerator.java b/core/src/main/java/org/eclipse/jgit/revwalk/FixUninterestingGenerator.javaindex 9d734a7296..4e6d7e681d 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/FixUninterestingGenerator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/FixUninterestingGenerator.java@@ -61,7 +61,7 @@ import org.eclipse.jgit.errors.MissingObjectException;final class FixUninterestingGenerator extends Generator {private final Generator pending;- FixUninterestingGenerator(final Generator g) {+ FixUninterestingGenerator(Generator g) {pending = g;}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.javaindex 9928286dcd..dae3aacb83 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/FollowFilter.java@@ -59,7 +59,8 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter;* triggers rename detection so that the path node is updated to include a prior* file name as the RevWalk traverses history.*- * The renames found will be reported to a {@link RenameCallback} if one is set.+ * The renames found will be reported to a+ * {@link org.eclipse.jgit.revwalk.RenameCallback} if one is set.* <p>* Results with this filter are unpredictable if the path being followed is a* subdirectory.@@ -81,7 +82,7 @@ public class FollowFilter extends TreeFilter {* @param cfg* diff config specifying rename detection options.* @return a new filter for the requested path.- * @throws IllegalArgumentException+ * @throws java.lang.IllegalArgumentException* the path supplied was the empty string.* @since 3.0*/@@ -94,33 +95,42 @@ public class FollowFilter extends TreeFilter {private RenameCallback renameCallback;- FollowFilter(final PathFilter path, final DiffConfig cfg) {+ FollowFilter(PathFilter path, DiffConfig cfg) {this.path = path;this.cfg = cfg;}/** @return the path this filter matches. */+ /**+ * Get the path this filter matches.+ *+ * @return the path this filter matches.+ */public String getPath() {return path.getPath();}+ /** {@inheritDoc} */@Override- public boolean include(final TreeWalk walker)+ public boolean include(TreeWalk walker)throws MissingObjectException, IncorrectObjectTypeException,IOException {return path.include(walker) && ANY_DIFF.include(walker);}+ /** {@inheritDoc} */@Overridepublic boolean shouldBeRecursive() {return path.shouldBeRecursive() || ANY_DIFF.shouldBeRecursive();}+ /** {@inheritDoc} */@Overridepublic TreeFilter clone() {return new FollowFilter(path.clone(), cfg);}+ /** {@inheritDoc} */@SuppressWarnings("nls")@Overridepublic String toString() {@@ -130,6 +140,8 @@ public class FollowFilter extends TreeFilter {}/**+ * Get the callback to which renames are reported.+ ** @return the callback to which renames are reported, or <code>null</code>* if none*/diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/FooterKey.java b/core/src/main/java/org/eclipse/jgit/revwalk/FooterKey.javaindex 36965f4996..45d5f809bb 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/FooterKey.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/FooterKey.java@@ -47,7 +47,9 @@ import java.util.Locale;import org.eclipse.jgit.lib.Constants;-/** Case insensitive key for a {@link FooterLine}. */+/**+ * Case insensitive key for a {@link org.eclipse.jgit.revwalk.FooterLine}.+ */public final class FooterKey {/** Standard {@code Signed-off-by} */public static final FooterKey SIGNED_OFF_BY = new FooterKey("Signed-off-by"); //$NON-NLS-1$@@ -68,16 +70,21 @@ public final class FooterKey {* @param keyName* name of the footer line.*/- public FooterKey(final String keyName) {+ public FooterKey(String keyName) {name = keyName;raw = Constants.encode(keyName.toLowerCase(Locale.ROOT));}- /** @return name of this footer line. */+ /**+ * Get name of this footer line.+ *+ * @return name of this footer line.+ */public String getName() {return name;}+ /** {@inheritDoc} */@SuppressWarnings("nls")@Overridepublic String toString() {diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/FooterLine.java b/core/src/main/java/org/eclipse/jgit/revwalk/FooterLine.javaindex b061d6ae13..d6fed66702 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/FooterLine.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/FooterLine.java@@ -80,11 +80,13 @@ public final class FooterLine {}/**+ * Whether keys match+ ** @param key* key to test this line's key name against.* @return true if {@code key.getName().equalsIgnorecase(getKey())}.*/- public boolean matches(final FooterKey key) {+ public boolean matches(FooterKey key) {final byte[] kRaw = key.raw;final int len = kRaw.length;int bPtr = keyStart;@@ -101,6 +103,8 @@ public final class FooterLine {}/**+ * Get key name of this footer.+ ** @return key name of this footer; that is the text before the ":" on the* line footer's line. The text is decoded according to the commit's* specified (or assumed) character encoding.@@ -110,6 +114,8 @@ public final class FooterLine {}/**+ * Get value of this footer.+ ** @return value of this footer; that is the text after the ":" and any* leading whitespace has been skipped. May be the empty string if* the footer has no value (line ended with ":"). The text is@@ -144,6 +150,7 @@ public final class FooterLine {return RawParseUtils.decode(enc, buffer, lt, gt - 1);}+ /** {@inheritDoc} */@Overridepublic String toString() {return getKey() + ": " + getValue(); //$NON-NLS-1$diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/Generator.java b/core/src/main/java/org/eclipse/jgit/revwalk/Generator.javaindex a95303b641..b2c92ea249 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/Generator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/Generator.java@@ -81,7 +81,7 @@ abstract class Generator {* @param q* another FIFO queue that wants to share our queue's free list.*/- void shareFreeList(final BlockRevQueue q) {+ void shareFreeList(BlockRevQueue q) {// Do nothing by default.}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/LIFORevQueue.java b/core/src/main/java/org/eclipse/jgit/revwalk/LIFORevQueue.javaindex f9da5b17ba..846b8d92fa 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/LIFORevQueue.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/LIFORevQueue.java@@ -49,22 +49,27 @@ import java.io.IOException;import org.eclipse.jgit.errors.IncorrectObjectTypeException;import org.eclipse.jgit.errors.MissingObjectException;-/** A queue of commits in LIFO order. */+/**+ * A queue of commits in LIFO order.+ */public class LIFORevQueue extends BlockRevQueue {private Block head;- /** Create an empty LIFO queue. */+ /**+ * Create an empty LIFO queue.+ */public LIFORevQueue() {super();}- LIFORevQueue(final Generator s) throws MissingObjectException,+ LIFORevQueue(Generator s) throws MissingObjectException,IncorrectObjectTypeException, IOException {super(s);}+ /** {@inheritDoc} */@Override- public void add(final RevCommit c) {+ public void add(RevCommit c) {Block b = head;if (b == null || !b.canUnpop()) {b = free.newBlock();@@ -75,6 +80,7 @@ public class LIFORevQueue extends BlockRevQueue {b.unpop(c);}+ /** {@inheritDoc} */@Overridepublic RevCommit next() {final Block b = head;@@ -89,6 +95,7 @@ public class LIFORevQueue extends BlockRevQueue {return c;}+ /** {@inheritDoc} */@Overridepublic void clear() {head = null;@@ -96,7 +103,7 @@ public class LIFORevQueue extends BlockRevQueue {}@Override- boolean everbodyHasFlag(final int f) {+ boolean everbodyHasFlag(int f) {for (Block b = head; b != null; b = b.next) {for (int i = b.headIndex; i < b.tailIndex; i++)if ((b.commits[i].flags & f) == 0)@@ -106,7 +113,7 @@ public class LIFORevQueue extends BlockRevQueue {}@Override- boolean anybodyHasFlag(final int f) {+ boolean anybodyHasFlag(int f) {for (Block b = head; b != null; b = b.next) {for (int i = b.headIndex; i < b.tailIndex; i++)if ((b.commits[i].flags & f) != 0)@@ -115,6 +122,7 @@ public class LIFORevQueue extends BlockRevQueue {return false;}+ /** {@inheritDoc} */@Overridepublic String toString() {final StringBuilder s = new StringBuilder();diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/LastCommitsOfChildren.java b/core/src/main/java/org/eclipse/jgit/revwalk/LastCommitsOfChildren.javaindex 7afef9ed42..5c978384a5 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/LastCommitsOfChildren.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/LastCommitsOfChildren.java@@ -2,6 +2,7 @@ package org.eclipse.jgit.revwalk;import java.io.IOException;import java.io.Serializable;+import java.nio.charset.StandardCharsets;import java.util.Date;import java.util.HashMap;import java.util.HashSet;@@ -229,7 +230,7 @@ public final class LastCommitsOfChildren extends HashMap<String, Value> {}if (modified) {childRef.set(RawParseUtils.decode(- Constants.CHARSET,+ StandardCharsets.UTF_8,walker.getRawPath(),treePathRaw.length!=0?treePathRaw.length+1:0,walkPathLen));diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/MergeBaseGenerator.java b/core/src/main/java/org/eclipse/jgit/revwalk/MergeBaseGenerator.javaindex 5d7e72dd29..2fe95318b2 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/MergeBaseGenerator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/MergeBaseGenerator.java@@ -69,32 +69,27 @@ import org.eclipse.jgit.internal.JGitText;*/class MergeBaseGenerator extends Generator {private static final int PARSED = RevWalk.PARSED;-private static final int IN_PENDING = RevWalk.SEEN;-private static final int POPPED = RevWalk.TEMP_MARK;-private static final int MERGE_BASE = RevWalk.REWRITE;private final RevWalk walker;-private final DateRevQueue pending;private int branchMask;-private int recarryTest;-private int recarryMask;-private int mergeBaseAncestor = -1;private LinkedList<RevCommit> ret = new LinkedList<>();- MergeBaseGenerator(final RevWalk w) {+ private CarryStack stack;++ MergeBaseGenerator(RevWalk w) {walker = w;pending = new DateRevQueue();}- void init(final AbstractRevQueue p) throws IOException {+ void init(AbstractRevQueue p) throws IOException {try {for (;;) {final RevCommit c = p.next();@@ -124,7 +119,7 @@ class MergeBaseGenerator extends Generator {}}- private void add(final RevCommit c) {+ private void add(RevCommit c) {final int flag = walker.allocFlag();branchMask |= flag;if ((c.flags & branchMask) != 0) {@@ -151,7 +146,7 @@ class MergeBaseGenerator extends Generator {return null;}- for (final RevCommit p : c.parents) {+ for (RevCommit p : c.parents) {if ((p.flags & IN_PENDING) != 0)continue;if ((p.flags & PARSED) == 0)@@ -202,29 +197,56 @@ class MergeBaseGenerator extends Generator {return null;}- private void carryOntoHistory(RevCommit c, final int carry) {+ private void carryOntoHistory(RevCommit c, int carry) {+ stack = null;for (;;) {- final RevCommit[] pList = c.parents;- if (pList == null)- return;- final int n = pList.length;- if (n == 0)- return;-- for (int i = 1; i < n; i++) {- final RevCommit p = pList[i];- if (!carryOntoOne(p, carry))- carryOntoHistory(p, carry);+ carryOntoHistoryInnerLoop(c, carry);+ if (stack == null) {+ break;+ }+ c = stack.c;+ carry = stack.carry;+ stack = stack.prev;+ }+ }++ private void carryOntoHistoryInnerLoop(RevCommit c, int carry) {+ for (;;) {+ RevCommit[] parents = c.parents;+ if (parents == null || parents.length == 0) {+ break;}- c = pList[0];- if (carryOntoOne(c, carry))+ int e = parents.length - 1;+ for (int i = 0; i < e; i++) {+ RevCommit p = parents[i];+ if (carryOntoOne(p, carry) == CONTINUE) {+ // Walking p will be required, buffer p on stack.+ stack = new CarryStack(stack, p, carry);+ }+ // For other results from carryOntoOne:+ // HAVE_ALL: p has all bits, do nothing to skip that path.+ // CONTINUE_ON_STACK: callee pushed StackElement for p.+ }++ c = parents[e];+ if (carryOntoOne(c, carry) != CONTINUE) {break;+ }}}- private boolean carryOntoOne(final RevCommit p, final int carry) {- final boolean haveAll = (p.flags & carry) == carry;+ private static final int CONTINUE = 0;+ private static final int HAVE_ALL = 1;+ private static final int CONTINUE_ON_STACK = 2;++ private int carryOntoOne(RevCommit p, int carry) {+ // If we already had all carried flags, our parents do too.+ // Return HAVE_ALL to stop caller from running down this leg+ // of the revision graph any further.+ //+ // Otherwise return CONTINUE to ask the caller to walk history.+ int rc = (p.flags & carry) == carry ? HAVE_ALL : CONTINUE;p.flags |= carry;if ((p.flags & recarryMask) == recarryTest) {@@ -232,17 +254,23 @@ class MergeBaseGenerator extends Generator {// voted to be one. Inject ourselves back at the front of the// pending queue and tell all of our ancestors they are within// the merge base now.- //p.flags &= ~POPPED;pending.add(p);- carryOntoHistory(p, branchMask | MERGE_BASE);- return true;+ stack = new CarryStack(stack, p, branchMask | MERGE_BASE);+ return CONTINUE_ON_STACK;}+ return rc;+ }- // If we already had all carried flags, our parents do too.- // Return true to stop the caller from running down this leg- // of the revision graph any further.- //- return haveAll;+ private static class CarryStack {+ final CarryStack prev;+ final RevCommit c;+ final int carry;++ CarryStack(CarryStack prev, RevCommit c, int carry) {+ this.prev = prev;+ this.c = c;+ this.carry = carry;+ }}}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java b/core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.javaindex 58689981b5..e5903c9117 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/ObjectWalk.java@@ -76,8 +76,9 @@ import org.eclipse.jgit.util.RawParseUtils;* scheduled for inclusion in the results of {@link #nextObject()}, returning* each object exactly once. Objects are sorted and returned according to the* the commits that reference them and the order they appear within a tree.- * Ordering can be affected by changing the {@link RevSort} used to order the- * commits that are returned first.+ * Ordering can be affected by changing the+ * {@link org.eclipse.jgit.revwalk.RevSort} used to order the commits that are+ * returned first.*/public class ObjectWalk extends RevWalk {private static final int ID_SZ = 20;@@ -118,7 +119,7 @@ public class ObjectWalk extends RevWalk {* @param repo* the repository the walker will obtain data from.*/- public ObjectWalk(final Repository repo) {+ public ObjectWalk(Repository repo) {this(repo.newObjectReader());}@@ -142,34 +143,39 @@ public class ObjectWalk extends RevWalk {/*** Mark an object or commit to start graph traversal from.* <p>- * Callers are encouraged to use {@link RevWalk#parseAny(AnyObjectId)}- * instead of {@link RevWalk#lookupAny(AnyObjectId, int)}, as this method- * requires the object to be parsed before it can be added as a root for the- * traversal.+ * Callers are encouraged to use+ * {@link org.eclipse.jgit.revwalk.RevWalk#parseAny(AnyObjectId)} instead of+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}, as+ * this method requires the object to be parsed before it can be added as a+ * root for the traversal.* <p>* The method will automatically parse an unparsed object, but error* handling may be more difficult for the application to explain why a* RevObject is not actually valid. The object pool of this walker would* also be 'poisoned' by the invalid RevObject.* <p>- * This method will automatically call {@link RevWalk#markStart(RevCommit)}- * if passed RevCommit instance, or a RevTag that directly (or indirectly)- * references a RevCommit.+ * This method will automatically call+ * {@link org.eclipse.jgit.revwalk.RevWalk#markStart(RevCommit)} if passed+ * RevCommit instance, or a RevTag that directly (or indirectly) references+ * a RevCommit.** @param o* the object to start traversing from. The object passed must be* from this same revision walker.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the object supplied is not available from the object* database. This usually indicates the supplied object is* invalid, but the reference was constructed during an earlier- * invocation to {@link RevWalk#lookupAny(AnyObjectId, int)}.- * @throws IncorrectObjectTypeException+ * invocation to+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}.+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* the object was not parsed yet and it was discovered during* parsing that it is not actually the type of the instance* passed in. This usually indicates the caller used the wrong- * type in a {@link RevWalk#lookupAny(AnyObjectId, int)} call.- * @throws IOException+ * type in a+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}+ * call.+ * @throws java.io.IOException* a pack file or loose object could not be read.*/public void markStart(RevObject o) throws MissingObjectException,@@ -193,33 +199,38 @@ public class ObjectWalk extends RevWalk {* reachable chain, back until the merge base of an uninteresting commit and* an otherwise interesting commit.* <p>- * Callers are encouraged to use {@link RevWalk#parseAny(AnyObjectId)}- * instead of {@link RevWalk#lookupAny(AnyObjectId, int)}, as this method- * requires the object to be parsed before it can be added as a root for the- * traversal.+ * Callers are encouraged to use+ * {@link org.eclipse.jgit.revwalk.RevWalk#parseAny(AnyObjectId)} instead of+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}, as+ * this method requires the object to be parsed before it can be added as a+ * root for the traversal.* <p>* The method will automatically parse an unparsed object, but error* handling may be more difficult for the application to explain why a* RevObject is not actually valid. The object pool of this walker would* also be 'poisoned' by the invalid RevObject.* <p>- * This method will automatically call {@link RevWalk#markStart(RevCommit)}- * if passed RevCommit instance, or a RevTag that directly (or indirectly)- * references a RevCommit.+ * This method will automatically call+ * {@link org.eclipse.jgit.revwalk.RevWalk#markStart(RevCommit)} if passed+ * RevCommit instance, or a RevTag that directly (or indirectly) references+ * a RevCommit.** @param o* the object to start traversing from. The object passed must be- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the object supplied is not available from the object* database. This usually indicates the supplied object is* invalid, but the reference was constructed during an earlier- * invocation to {@link RevWalk#lookupAny(AnyObjectId, int)}.- * @throws IncorrectObjectTypeException+ * invocation to+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}.+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* the object was not parsed yet and it was discovered during* parsing that it is not actually the type of the instance* passed in. This usually indicates the caller used the wrong- * type in a {@link RevWalk#lookupAny(AnyObjectId, int)} call.- * @throws IOException+ * type in a+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}+ * call.+ * @throws java.io.IOException* a pack file or loose object could not be read.*/public void markUninteresting(RevObject o) throws MissingObjectException,@@ -243,12 +254,14 @@ public class ObjectWalk extends RevWalk {addObject(o);}+ /** {@inheritDoc} */@Overridepublic void sort(RevSort s) {super.sort(s);boundary = hasRevSort(RevSort.BOUNDARY);}+ /** {@inheritDoc} */@Overridepublic void sort(RevSort s, boolean use) {super.sort(s, use);@@ -259,7 +272,6 @@ public class ObjectWalk extends RevWalk {* Get the currently configured object filter.** @return the current filter. Never null as a filter is always needed.- ** @since 4.0*/public ObjectFilter getObjectFilter() {@@ -267,9 +279,9 @@ public class ObjectWalk extends RevWalk {}/**- * Set the object filter for this walker. This filter affects the objects- * visited by {@link #nextObject()}. It does not affect the commits- * listed by {@link #next()}.+ * Set the object filter for this walker. This filter affects the objects+ * visited by {@link #nextObject()}. It does not affect the commits listed+ * by {@link #next()}.* <p>* If the filter returns false for an object, then that object is skipped* and objects reachable from it are not enqueued to be walked recursively.@@ -277,9 +289,9 @@ public class ObjectWalk extends RevWalk {* are known to be uninteresting.** @param newFilter- * the new filter. If null the special {@link ObjectFilter#ALL}+ * the new filter. If null the special+ * {@link org.eclipse.jgit.revwalk.filter.ObjectFilter#ALL}* filter will be used instead, as it matches every object.- ** @since 4.0*/public void setObjectFilter(ObjectFilter newFilter) {@@ -287,6 +299,7 @@ public class ObjectWalk extends RevWalk {objectFilter = newFilter != null ? newFilter : ObjectFilter.ALL;}+ /** {@inheritDoc} */@Overridepublic RevCommit next() throws MissingObjectException,IncorrectObjectTypeException, IOException {@@ -316,14 +329,14 @@ public class ObjectWalk extends RevWalk {* Pop the next most recent object.** @return next most recent object; null if traversal is over.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* one or or more of the next objects are not available from the* object database, but were thought to be candidates for* traversal. This usually indicates a broken link.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* one or or more of the objects in a tree do not match the type* indicated.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/public RevObject nextObject() throws MissingObjectException,@@ -520,14 +533,14 @@ public class ObjectWalk extends RevWalk {* exception if there is a connectivity problem. The exception message* provides some detail about the connectivity failure.*- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* one or or more of the next objects are not available from the* object database, but were thought to be candidates for* traversal. This usually indicates a broken link.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* one or or more of the objects in a tree do not match the type* indicated.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/public void checkConnectivity() throws MissingObjectException,@@ -618,14 +631,22 @@ public class ObjectWalk extends RevWalk {return hash;}- /** @return the internal buffer holding the current path. */+ /**+ * Get the internal buffer holding the current path.+ *+ * @return the internal buffer holding the current path.+ */public byte[] getPathBuffer() {if (pathLen == 0)pathLen = updatePathBuf(currVisit);return pathBuf;}- /** @return length of the path in {@link #getPathBuffer()}. */+ /**+ * Get length of the path in {@link #getPathBuffer()}.+ *+ * @return length of the path in {@link #getPathBuffer()}.+ */public int getPathLength() {if (pathLen == 0)pathLen = updatePathBuf(currVisit);@@ -667,6 +688,7 @@ public class ObjectWalk extends RevWalk {pathBuf = newBuf;}+ /** {@inheritDoc} */@Overridepublic void dispose() {super.dispose();@@ -675,8 +697,9 @@ public class ObjectWalk extends RevWalk {freeVisit = null;}+ /** {@inheritDoc} */@Override- protected void reset(final int retainFlags) {+ protected void reset(int retainFlags) {super.reset(retainFlags);for (RevObject obj : rootObjects)@@ -688,7 +711,7 @@ public class ObjectWalk extends RevWalk {freeVisit = null;}- private void addObject(final RevObject o) {+ private void addObject(RevObject o) {if ((o.flags & IN_PENDING) == 0) {o.flags |= IN_PENDING;rootObjects.add(o);@@ -696,7 +719,7 @@ public class ObjectWalk extends RevWalk {}}- private void markTreeUninteresting(final RevTree tree)+ private void markTreeUninteresting(RevTree tree)throws MissingObjectException, IncorrectObjectTypeException,IOException {if ((tree.flags & UNINTERESTING) != 0)diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/PendingGenerator.java b/core/src/main/java/org/eclipse/jgit/revwalk/PendingGenerator.javaindex 94ae2c993c..e607b7daa0 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/PendingGenerator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/PendingGenerator.java@@ -140,7 +140,7 @@ class PendingGenerator extends Generator {produce = filter.include(walker, c);}- for (final RevCommit p : c.parents) {+ for (RevCommit p : c.parents) {if ((p.flags & SEEN) != 0)continue;if ((p.flags & PARSED) == 0)diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RenameCallback.java b/core/src/main/java/org/eclipse/jgit/revwalk/RenameCallback.javaindex 377835534e..7754f18e9a 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RenameCallback.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RenameCallback.java@@ -46,8 +46,9 @@ import org.eclipse.jgit.diff.DiffEntry;/*** An instance of this class can be used in conjunction with a- * {@link FollowFilter}. Whenever a rename has been detected during a revision- * walk, it will be reported here.+ * {@link org.eclipse.jgit.revwalk.FollowFilter}. Whenever a rename has been+ * detected during a revision walk, it will be reported here.+ ** @see FollowFilter#setRenameCallback(RenameCallback)*/public abstract class RenameCallback {diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevBlob.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevBlob.javaindex 4245fcab94..cc5e3e40db 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevBlob.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevBlob.java@@ -52,7 +52,9 @@ import org.eclipse.jgit.errors.MissingObjectException;import org.eclipse.jgit.lib.AnyObjectId;import org.eclipse.jgit.lib.Constants;-/** A binary file, or a symbolic link. */+/**+ * A binary file, or a symbolic link.+ */public class RevBlob extends RevObject {/*** Create a new blob reference.@@ -60,10 +62,11 @@ public class RevBlob extends RevObject {* @param id* object name for the blob.*/- protected RevBlob(final AnyObjectId id) {+ protected RevBlob(AnyObjectId id) {super(id);}+ /** {@inheritDoc} */@Overridepublic final int getType() {return Constants.OBJ_BLOB;diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevCommit.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevCommit.javaindex 7b6393044a..86ecd8eaee 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevCommit.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevCommit.java@@ -51,6 +51,7 @@ import java.nio.charset.Charset;import java.nio.charset.IllegalCharsetNameException;import java.nio.charset.UnsupportedCharsetException;import java.util.ArrayList;+import java.util.Arrays;import java.util.Collections;import java.util.List;@@ -66,7 +67,9 @@ import org.eclipse.jgit.lib.PersonIdent;import org.eclipse.jgit.util.RawParseUtils;import org.eclipse.jgit.util.StringUtils;-/** A commit reference to a commit in the DAG. */+/**+ * A commit reference to a commit in the DAG.+ */public class RevCommit extends RevObject {private static final int STACK_DEPTH = 500;@@ -79,7 +82,8 @@ public class RevCommit extends RevObject {* will not have their headers loaded.** Applications are discouraged from using this API. Callers usually need- * more than one commit. Use {@link RevWalk#parseCommit(AnyObjectId)} to+ * more than one commit. Use+ * {@link org.eclipse.jgit.revwalk.RevWalk#parseCommit(AnyObjectId)} to* obtain a RevCommit from an existing repository.** @param raw@@ -115,7 +119,7 @@ public class RevCommit extends RevObject {* modified by the caller.* @return the parsed commit, in an isolated revision pool that is not* available to the caller.- * @throws IOException+ * @throws java.io.IOException* in case of RevWalk initialization fails*/public static RevCommit parse(RevWalk rw, byte[] raw) throws IOException {@@ -145,18 +149,18 @@ public class RevCommit extends RevObject {* @param id* object name for the commit.*/- protected RevCommit(final AnyObjectId id) {+ protected RevCommit(AnyObjectId id) {super(id);}@Override- void parseHeaders(final RevWalk walk) throws MissingObjectException,+ void parseHeaders(RevWalk walk) throws MissingObjectException,IncorrectObjectTypeException, IOException {parseCanonical(walk, walk.getCachedBytes(this));}@Override- void parseBody(final RevWalk walk) throws MissingObjectException,+ void parseBody(RevWalk walk) throws MissingObjectException,IncorrectObjectTypeException, IOException {if (buffer == null) {buffer = walk.getCachedBytes(this);@@ -165,10 +169,10 @@ public class RevCommit extends RevObject {}}- void parseCanonical(final RevWalk walk, final byte[] raw)- throws IOException {- if (!walk.shallowCommitsInitialized)- walk.initializeShallowCommits();+ void parseCanonical(RevWalk walk, byte[] raw) throws IOException {+ if (!walk.shallowCommitsInitialized) {+ walk.initializeShallowCommits(this);+ }final MutableObjectId idBuffer = walk.idBuffer;idBuffer.fromString(raw, 5);@@ -179,13 +183,14 @@ public class RevCommit extends RevObject {RevCommit[] pList = new RevCommit[1];int nParents = 0;for (;;) {- if (raw[ptr] != 'p')+ if (raw[ptr] != 'p') {break;+ }idBuffer.fromString(raw, ptr + 7);final RevCommit p = walk.lookupCommit(idBuffer);- if (nParents == 0)+ if (nParents == 0) {pList[nParents++] = p;- else if (nParents == 1) {+ } else if (nParents == 1) {pList = new RevCommit[] { pList[0], p };nParents = 2;} else {@@ -215,11 +220,13 @@ public class RevCommit extends RevObject {commitTime = RawParseUtils.parseBase10(raw, ptr, null);}- if (walk.isRetainBody())+ if (walk.isRetainBody()) {buffer = raw;+ }flags |= PARSED;}+ /** {@inheritDoc} */@Overridepublic final int getType() {return Constants.OBJ_COMMIT;@@ -306,7 +313,7 @@ public class RevCommit extends RevObject {* @param flag* the single flag value to carry back onto parents.*/- public void carry(final RevFlag flag) {+ public void carry(RevFlag flag) {final int carry = flags & flag.mask;if (carry != 0)carryFlags(this, carry);@@ -315,7 +322,7 @@ public class RevCommit extends RevObject {/*** Time from the "committer " line of the buffer.*- * @return time, expressed as seconds since the epoch.+ * @return commit time*/public final int getCommitTime() {return commitTime;@@ -346,10 +353,10 @@ public class RevCommit extends RevObject {* parent index to obtain. Must be in the range 0 through* {@link #getParentCount()}-1.* @return the specified parent.- * @throws ArrayIndexOutOfBoundsException+ * @throws java.lang.ArrayIndexOutOfBoundsException* an invalid parent index was specified.*/- public final RevCommit getParent(final int nth) {+ public final RevCommit getParent(int nth) {return parents[nth];}@@ -383,20 +390,49 @@ public class RevCommit extends RevObject {return buffer;}+ /**+ * Parse the gpg signature from the raw buffer.+ * <p>+ * This method parses and returns the raw content of the gpgsig lines. This+ * method is fairly expensive and produces a new byte[] instance on each+ * invocation. Callers should invoke this method only if they are certain+ * they will need, and should cache the return value for as long as+ * necessary to use all information from it.+ * <p>+ * RevFilter implementations should try to use+ * {@link org.eclipse.jgit.util.RawParseUtils} to scan the+ * {@link #getRawBuffer()} instead, as this will allow faster evaluation of+ * commits.+ *+ * @return contents of the gpg signature; null if the commit was not signed.+ * @since 5.1+ */+ public final @Nullable byte[] getRawGpgSignature() {+ final byte[] raw = buffer;+ final byte[] header = {'g', 'p', 'g', 's', 'i', 'g'};+ final int start = RawParseUtils.headerStart(header, raw, 0);+ if (start < 0) {+ return null;+ }+ final int end = RawParseUtils.headerEnd(raw, start);+ return Arrays.copyOfRange(raw, start, end);+ }+/*** Parse the author identity from the raw buffer.* <p>* This method parses and returns the content of the author line, after- * taking the commit's character set into user and decoding the author+ * taking the commit's character set into account and decoding the author* name and email address. This method is fairly expensive and produces a* new PersonIdent instance on each invocation. Callers should invoke this* method only if they are certain they will be outputting the result, and* should cache the return value for as long as necessary to use all* information from it.* <p>- * RevFilter implementations should try to use {@link RawParseUtils} to scan- * the {@link #getRawBuffer()} instead, as this will allow faster evaluation- * of commits.+ * RevFilter implementations should try to use+ * {@link org.eclipse.jgit.util.RawParseUtils} to scan the+ * {@link #getRawBuffer()} instead, as this will allow faster evaluation of+ * commits.** @return identity of the author (name, email) and the time the commit was* made by the author; null if no author line was found.@@ -413,16 +449,17 @@ public class RevCommit extends RevObject {* Parse the committer identity from the raw buffer.* <p>* This method parses and returns the content of the committer line, after- * taking the commit's character set into user and decoding the committer+ * taking the commit's character set into account and decoding the committer* name and email address. This method is fairly expensive and produces a* new PersonIdent instance on each invocation. Callers should invoke this* method only if they are certain they will be outputting the result, and* should cache the return value for as long as necessary to use all* information from it.* <p>- * RevFilter implementations should try to use {@link RawParseUtils} to scan- * the {@link #getRawBuffer()} instead, as this will allow faster evaluation- * of commits.+ * RevFilter implementations should try to use+ * {@link org.eclipse.jgit.util.RawParseUtils} to scan the+ * {@link #getRawBuffer()} instead, as this will allow faster evaluation of+ * commits.** @return identity of the committer (name, email) and the time the commit* was made by the committer; null if no committer line was found.@@ -439,7 +476,7 @@ public class RevCommit extends RevObject {* Parse the complete commit message and decode it to a string.* <p>* This method parses and returns the message portion of the commit buffer,- * after taking the commit's character set into user and decoding the+ * after taking the commit's character set into account and decoding the* buffer using that character set. This method is a fairly expensive* operation and produces a new string on each invocation.*@@ -461,7 +498,7 @@ public class RevCommit extends RevObject {* "oneline" format, suitable for output in a single line display.* <p>* This method parses and returns the message portion of the commit buffer,- * after taking the commit's character set into user and decoding the+ * after taking the commit's character set into account and decoding the* buffer using that character set. This method is a fairly expensive* operation and produces a new string on each invocation.*@@ -484,7 +521,7 @@ public class RevCommit extends RevObject {return str;}- static boolean hasLF(final byte[] r, int b, final int e) {+ static boolean hasLF(byte[] r, int b, int e) {while (b < e)if (r[b++] == '\n')return true;@@ -609,7 +646,7 @@ public class RevCommit extends RevObject {* with the specified key, or there are no footers at all.* @see #getFooterLines()*/- public final List<String> getFooterLines(final String keyName) {+ public final List<String> getFooterLines(String keyName) {return getFooterLines(new FooterKey(keyName));}@@ -624,12 +661,12 @@ public class RevCommit extends RevObject {* with the specified key, or there are no footers at all.* @see #getFooterLines()*/- public final List<String> getFooterLines(final FooterKey keyName) {+ public final List<String> getFooterLines(FooterKey keyName) {final List<FooterLine> src = getFooterLines();if (src.isEmpty())return Collections.emptyList();final ArrayList<String> r = new ArrayList<>(src.size());- for (final FooterLine f : src) {+ for (FooterLine f : src) {if (f.matches(keyName))r.add(f.getValue());}@@ -654,7 +691,7 @@ public class RevCommit extends RevObject {* time in {@link #getCommitTime()}. Accessing other properties such as* {@link #getAuthorIdent()}, {@link #getCommitterIdent()} or either message* function requires reloading the buffer by invoking- * {@link RevWalk#parseBody(RevObject)}.+ * {@link org.eclipse.jgit.revwalk.RevWalk#parseBody(RevObject)}.** @since 4.0*/@@ -662,6 +699,7 @@ public class RevCommit extends RevObject {buffer = null;}+ /** {@inheritDoc} */@Overridepublic String toString() {final StringBuilder s = new StringBuilder();diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevCommitList.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevCommitList.javaindex 64f99bbd28..d2fda2f91e 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevCommitList.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevCommitList.java@@ -50,7 +50,7 @@ import org.eclipse.jgit.errors.MissingObjectException;import org.eclipse.jgit.revwalk.filter.RevFilter;/**- * An ordered list of {@link RevCommit} subclasses.+ * An ordered list of {@link org.eclipse.jgit.revwalk.RevCommit} subclasses.** @param <E>* type of subclass of RevCommit the list is storing.@@ -58,6 +58,7 @@ import org.eclipse.jgit.revwalk.filter.RevFilter;public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {private RevWalk walker;+ /** {@inheritDoc} */@Overridepublic void clear() {super.clear();@@ -77,20 +78,20 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* @param flag* the flag to apply (or remove). Applications are responsible* for allocating this flag from the source RevWalk.- * @throws IOException+ * @throws java.io.IOException* revision filter needed to read additional objects, but an* error occurred while reading the pack files or loose objects* of the repository.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* revision filter needed to read additional objects, but an* object was not of the correct type. Repository corruption may* have occurred.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* revision filter needed to read additional objects, but an* object that should be present was not found. Repository* corruption may have occurred.*/- public void applyFlag(final RevFilter matching, final RevFlag flag)+ public void applyFlag(RevFilter matching, RevFlag flag)throws MissingObjectException, IncorrectObjectTypeException,IOException {applyFlag(matching, flag, 0, size());@@ -117,15 +118,15 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* last commit within the list to end testing at, exclusive. If* smaller than or equal to <code>rangeBegin</code> then no* commits will be tested.- * @throws IOException+ * @throws java.io.IOException* revision filter needed to read additional objects, but an* error occurred while reading the pack files or loose objects* of the repository.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* revision filter needed to read additional objects, but an* object was not of the correct type. Repository corruption may* have occurred.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* revision filter needed to read additional objects, but an* object that should be present was not found. Repository* corruption may have occurred.@@ -164,7 +165,7 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* the flag to remove. Applications are responsible for* allocating this flag from the source RevWalk.*/- public void clearFlag(final RevFlag flag) {+ public void clearFlag(RevFlag flag) {clearFlag(flag, 0, size());}@@ -206,7 +207,7 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* @return index of the first commit at or after index <code>begin</code>* that has the specified flag set on it; -1 if no match is found.*/- public int indexOf(final RevFlag flag, int begin) {+ public int indexOf(RevFlag flag, int begin) {while (begin < size()) {int index = begin;Block s = contents;@@ -237,7 +238,7 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* @return index of the first commit at or before index <code>begin</code>* that has the specified flag set on it; -1 if no match is found.*/- public int lastIndexOf(final RevFlag flag, int begin) {+ public int lastIndexOf(RevFlag flag, int begin) {begin = Math.min(begin, size() - 1);while (begin >= 0) {int index = begin;@@ -264,7 +265,7 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* the walker to populate from.* @see #fillTo(int)*/- public void source(final RevWalk w) {+ public void source(RevWalk w) {walker = w;}@@ -290,15 +291,15 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* @param highMark* number of commits the caller wants this list to contain when* the fill operation is complete.- * @throws IOException- * see {@link RevWalk#next()}- * @throws IncorrectObjectTypeException- * see {@link RevWalk#next()}- * @throws MissingObjectException- * see {@link RevWalk#next()}+ * @throws java.io.IOException+ * see {@link org.eclipse.jgit.revwalk.RevWalk#next()}+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException+ * see {@link org.eclipse.jgit.revwalk.RevWalk#next()}+ * @throws org.eclipse.jgit.errors.MissingObjectException+ * see {@link org.eclipse.jgit.revwalk.RevWalk#next()}*/@SuppressWarnings("unchecked")- public void fillTo(final int highMark) throws MissingObjectException,+ public void fillTo(int highMark) throws MissingObjectException,IncorrectObjectTypeException, IOException {if (walker == null || size > highMark)return;@@ -355,15 +356,15 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* contain when the fill operation is complete. If highMark is 0* the walk is pumped until the specified commit or the end of* the walk is reached.- * @throws IOException- * see {@link RevWalk#next()}- * @throws IncorrectObjectTypeException- * see {@link RevWalk#next()}- * @throws MissingObjectException- * see {@link RevWalk#next()}+ * @throws java.io.IOException+ * see {@link org.eclipse.jgit.revwalk.RevWalk#next()}+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException+ * see {@link org.eclipse.jgit.revwalk.RevWalk#next()}+ * @throws org.eclipse.jgit.errors.MissingObjectException+ * see {@link org.eclipse.jgit.revwalk.RevWalk#next()}*/@SuppressWarnings("unchecked")- public void fillTo(final RevCommit commitToLoad, int highMark)+ public void fillTo(RevCommit commitToLoad, int highMark)throws MissingObjectException, IncorrectObjectTypeException,IOException {if (walker == null || commitToLoad == null@@ -418,7 +419,7 @@ public class RevCommitList<E extends RevCommit> extends RevObjectList<E> {* @param e* the object being added (or set) into the list.*/- protected void enter(final int index, final E e) {+ protected void enter(int index, E e) {// Do nothing by default.}}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevFlag.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevFlag.javaindex dae52f85db..413a552962 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevFlag.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevFlag.java@@ -48,9 +48,10 @@ import java.text.MessageFormat;import org.eclipse.jgit.internal.JGitText;/**- * Application level mark bit for {@link RevObject}s.+ * Application level mark bit for {@link org.eclipse.jgit.revwalk.RevObject}s.* <p>- * To create a flag use {@link RevWalk#newFlag(String)}.+ * To create a flag use+ * {@link org.eclipse.jgit.revwalk.RevWalk#newFlag(String)}.*/public class RevFlag {/**@@ -84,7 +85,7 @@ public class RevFlag {final int mask;- RevFlag(final RevWalk w, final String n, final int m) {+ RevFlag(RevWalk w, String n, int m) {walker = w;name = n;mask = m;@@ -99,13 +100,14 @@ public class RevFlag {return walker;}+ /** {@inheritDoc} */@Overridepublic String toString() {return name;}static class StaticRevFlag extends RevFlag {- StaticRevFlag(final String n, final int m) {+ StaticRevFlag(String n, int m) {super(null, n, m);}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevFlagSet.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevFlagSet.javaindex bb699e08c4..45a730cfd2 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevFlagSet.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevFlagSet.java@@ -50,7 +50,8 @@ import java.util.Iterator;import java.util.List;/**- * Multiple application level mark bits for {@link RevObject}s.+ * Multiple application level mark bits for+ * {@link org.eclipse.jgit.revwalk.RevObject}s.** @see RevFlag*/@@ -59,7 +60,9 @@ public class RevFlagSet extends AbstractSet<RevFlag> {private final List<RevFlag> active;- /** Create an empty set of flags. */+ /**+ * Create an empty set of flags.+ */public RevFlagSet() {active = new ArrayList<>();}@@ -70,7 +73,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> {* @param s* the set to copy flags from.*/- public RevFlagSet(final RevFlagSet s) {+ public RevFlagSet(RevFlagSet s) {mask = s.mask;active = new ArrayList<>(s.active);}@@ -81,20 +84,22 @@ public class RevFlagSet extends AbstractSet<RevFlag> {* @param s* the collection to copy flags from.*/- public RevFlagSet(final Collection<RevFlag> s) {+ public RevFlagSet(Collection<RevFlag> s) {this();addAll(s);}+ /** {@inheritDoc} */@Override- public boolean contains(final Object o) {+ public boolean contains(Object o) {if (o instanceof RevFlag)return (mask & ((RevFlag) o).mask) != 0;return false;}+ /** {@inheritDoc} */@Override- public boolean containsAll(final Collection<?> c) {+ public boolean containsAll(Collection<?> c) {if (c instanceof RevFlagSet) {final int cMask = ((RevFlagSet) c).mask;return (mask & cMask) == cMask;@@ -102,8 +107,9 @@ public class RevFlagSet extends AbstractSet<RevFlag> {return super.containsAll(c);}+ /** {@inheritDoc} */@Override- public boolean add(final RevFlag flag) {+ public boolean add(RevFlag flag) {if ((mask & flag.mask) != 0)return false;mask |= flag.mask;@@ -114,8 +120,9 @@ public class RevFlagSet extends AbstractSet<RevFlag> {return true;}+ /** {@inheritDoc} */@Override- public boolean remove(final Object o) {+ public boolean remove(Object o) {final RevFlag flag = (RevFlag) o;if ((mask & flag.mask) == 0)return false;@@ -126,6 +133,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> {return true;}+ /** {@inheritDoc} */@Overridepublic Iterator<RevFlag> iterator() {final Iterator<RevFlag> i = active.iterator();@@ -150,6 +158,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> {};}+ /** {@inheritDoc} */@Overridepublic int size() {return active.size();diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevObject.javaindex 7561927dff..eef9bf33e0 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevObject.java@@ -52,13 +52,15 @@ import org.eclipse.jgit.lib.Constants;import org.eclipse.jgit.lib.ObjectId;import org.eclipse.jgit.lib.ObjectIdOwnerMap;-/** Base object type accessed during revision walking. */+/**+ * Base object type accessed during revision walking.+ */public abstract class RevObject extends ObjectIdOwnerMap.Entry {static final int PARSED = 1;int flags;- RevObject(final AnyObjectId name) {+ RevObject(AnyObjectId name) {super(name);}@@ -69,7 +71,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {IncorrectObjectTypeException, IOException;/**- * Get Git object type. See {@link Constants}.+ * Get Git object type. See {@link org.eclipse.jgit.lib.Constants}.** @return object type*/@@ -91,7 +93,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {* the flag to test.* @return true if the flag has been added to this object; false if not.*/- public final boolean has(final RevFlag flag) {+ public final boolean has(RevFlag flag) {return (flags & flag.mask) != 0;}@@ -103,7 +105,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {* @return true if any flag in the set has been added to this object; false* if not.*/- public final boolean hasAny(final RevFlagSet set) {+ public final boolean hasAny(RevFlagSet set) {return (flags & set.mask) != 0;}@@ -115,7 +117,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {* @return true if all flags of the set have been added to this object;* false if some or none have been added.*/- public final boolean hasAll(final RevFlagSet set) {+ public final boolean hasAll(RevFlagSet set) {return (flags & set.mask) == set.mask;}@@ -127,7 +129,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {* @param flag* the flag to mark on this object, for later testing.*/- public final void add(final RevFlag flag) {+ public final void add(RevFlag flag) {flags |= flag.mask;}@@ -137,7 +139,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {* @param set* the set of flags to mark on this object, for later testing.*/- public final void add(final RevFlagSet set) {+ public final void add(RevFlagSet set) {flags |= set.mask;}@@ -149,7 +151,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {* @param flag* the flag to remove from this object.*/- public final void remove(final RevFlag flag) {+ public final void remove(RevFlag flag) {flags &= ~flag.mask;}@@ -159,10 +161,11 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {* @param set* the flag to remove from this object.*/- public final void remove(final RevFlagSet set) {+ public final void remove(RevFlagSet set) {flags &= ~set.mask;}+ /** {@inheritDoc} */@Overridepublic String toString() {final StringBuilder s = new StringBuilder();@@ -175,10 +178,12 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry {}/**+ * Append a debug description of core RevFlags to a buffer.+ ** @param s* buffer to append a debug description of core RevFlags onto.*/- protected void appendCoreFlags(final StringBuilder s) {+ protected void appendCoreFlags(StringBuilder s) {s.append((flags & RevWalk.TOPO_DELAY) != 0 ? 'o' : '-');s.append((flags & RevWalk.TEMP_MARK) != 0 ? 't' : '-');s.append((flags & RevWalk.REWRITE) != 0 ? 'r' : '-');diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevObjectList.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevObjectList.javaindex 95986782cd..2f21e17455 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevObjectList.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevObjectList.java@@ -51,7 +51,7 @@ import java.util.AbstractList;import org.eclipse.jgit.internal.JGitText;/**- * An ordered list of {@link RevObject} subclasses.+ * An ordered list of {@link org.eclipse.jgit.revwalk.RevObject} subclasses.** @param <E>* type of subclass of RevObject the list is storing.@@ -73,13 +73,16 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> {/** Current number of elements in the list. */protected int size = 0;- /** Create an empty object list. */+ /**+ * Create an empty object list.+ */public RevObjectList() {// Initialized above.}+ /** {@inheritDoc} */@Override- public void add(final int index, final E element) {+ public void add(int index, E element) {if (index != size)throw new UnsupportedOperationException(MessageFormat.format(JGitText.get().unsupportedOperationNotAddAtEnd,@@ -88,6 +91,7 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> {size++;}+ /** {@inheritDoc} */@Override@SuppressWarnings("unchecked")public E set(int index, E element) {@@ -109,6 +113,7 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> {return (E) old;}+ /** {@inheritDoc} */@Override@SuppressWarnings("unchecked")public E get(int index) {@@ -123,11 +128,13 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> {return s != null ? (E) s.contents[index] : null;}+ /** {@inheritDoc} */@Overridepublic int size() {return size;}+ /** {@inheritDoc} */@Overridepublic void clear() {contents = new Block(0);@@ -140,7 +147,7 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> {final int shift;- Block(final int s) {+ Block(int s) {shift = s;}}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevSort.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevSort.javaindex 238af12fdb..a3b31a1922 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevSort.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevSort.java@@ -44,7 +44,10 @@package org.eclipse.jgit.revwalk;-/** Sorting strategies supported by {@link RevWalk} and {@link ObjectWalk}. */+/**+ * Sorting strategies supported by {@link org.eclipse.jgit.revwalk.RevWalk} and+ * {@link org.eclipse.jgit.revwalk.ObjectWalk}.+ */public enum RevSort {/*** No specific sorting is requested.diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevTag.javaindex 1be5d6a6b7..32e7adfb0c 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevTag.java@@ -64,7 +64,9 @@ import org.eclipse.jgit.util.MutableInteger;import org.eclipse.jgit.util.RawParseUtils;import org.eclipse.jgit.util.StringUtils;-/** An annotated tag. */+/**+ * An annotated tag.+ */public class RevTag extends RevObject {/*** Parse an annotated tag from its canonical format.@@ -75,14 +77,15 @@ public class RevTag extends RevObject {* not have its headers loaded.** Applications are discouraged from using this API. Callers usually need- * more than one object. Use {@link RevWalk#parseTag(AnyObjectId)} to obtain+ * more than one object. Use+ * {@link org.eclipse.jgit.revwalk.RevWalk#parseTag(AnyObjectId)} to obtain* a RevTag from an existing repository.** @param raw* the canonical formatted tag to be parsed.* @return the parsed tag, in an isolated revision pool that is not* available to the caller.- * @throws CorruptObjectException+ * @throws org.eclipse.jgit.errors.CorruptObjectException* the tag contains a malformed header that cannot be handled.*/public static RevTag parse(byte[] raw) throws CorruptObjectException {@@ -109,7 +112,7 @@ public class RevTag extends RevObject {* modified by the caller.* @return the parsed tag, in an isolated revision pool that is not* available to the caller.- * @throws CorruptObjectException+ * @throws org.eclipse.jgit.errors.CorruptObjectException* the tag contains a malformed header that cannot be handled.*/public static RevTag parse(RevWalk rw, byte[] raw)@@ -134,18 +137,18 @@ public class RevTag extends RevObject {* @param id* object name for the tag.*/- protected RevTag(final AnyObjectId id) {+ protected RevTag(AnyObjectId id) {super(id);}@Override- void parseHeaders(final RevWalk walk) throws MissingObjectException,+ void parseHeaders(RevWalk walk) throws MissingObjectException,IncorrectObjectTypeException, IOException {parseCanonical(walk, walk.getCachedBytes(this));}@Override- void parseBody(final RevWalk walk) throws MissingObjectException,+ void parseBody(RevWalk walk) throws MissingObjectException,IncorrectObjectTypeException, IOException {if (buffer == null) {buffer = walk.getCachedBytes(this);@@ -154,7 +157,7 @@ public class RevTag extends RevObject {}}- void parseCanonical(final RevWalk walk, final byte[] rawTag)+ void parseCanonical(RevWalk walk, byte[] rawTag)throws CorruptObjectException {final MutableInteger pos = new MutableInteger();final int oType;@@ -173,6 +176,7 @@ public class RevTag extends RevObject {flags |= PARSED;}+ /** {@inheritDoc} */@Overridepublic final int getType() {return Constants.OBJ_TAG;@@ -182,7 +186,7 @@ public class RevTag extends RevObject {* Parse the tagger identity from the raw buffer.* <p>* This method parses and returns the content of the tagger line, after- * taking the tag's character set into user and decoding the tagger+ * taking the tag's character set into account and decoding the tagger* name and email address. This method is fairly expensive and produces a* new PersonIdent instance on each invocation. Callers should invoke this* method only if they are certain they will be outputting the result, and@@ -204,7 +208,7 @@ public class RevTag extends RevObject {* Parse the complete tag message and decode it to a string.* <p>* This method parses and returns the message portion of the tag buffer,- * after taking the tag's character set into user and decoding the buffer+ * after taking the tag's character set into account and decoding the buffer* using that character set. This method is a fairly expensive operation and* produces a new string on each invocation.*@@ -226,7 +230,7 @@ public class RevTag extends RevObject {* "oneline" format, suitable for output in a single line display.* <p>* This method parses and returns the message portion of the tag buffer,- * after taking the tag's character set into user and decoding the buffer+ * after taking the tag's character set into account and decoding the buffer* using that character set. This method is a fairly expensive operation and* produces a new string on each invocation.*@@ -261,12 +265,15 @@ public class RevTag extends RevObject {* Get a reference to the object this tag was placed on.* <p>* Note that the returned object has only been looked up (see- * {@link RevWalk#lookupAny(AnyObjectId, int)}. To access the contents it- * needs to be parsed, see {@link RevWalk#parseHeaders(RevObject)} and- * {@link RevWalk#parseBody(RevObject)}.+ * {@link org.eclipse.jgit.revwalk.RevWalk#lookupAny(AnyObjectId, int)}. To+ * access the contents it needs to be parsed, see+ * {@link org.eclipse.jgit.revwalk.RevWalk#parseHeaders(RevObject)} and+ * {@link org.eclipse.jgit.revwalk.RevWalk#parseBody(RevObject)}.* <p>- * As an alternative, use {@link RevWalk#peel(RevObject)} and pass this- * {@link RevTag} to peel it until the first non-tag object.+ * As an alternative, use+ * {@link org.eclipse.jgit.revwalk.RevWalk#peel(RevObject)} and pass this+ * {@link org.eclipse.jgit.revwalk.RevTag} to peel it until the first+ * non-tag object.** @return object this tag refers to (only looked up, not parsed)*/@@ -290,7 +297,7 @@ public class RevTag extends RevObject {* only the {@link #getObject()} pointer and {@link #getTagName()}.* Accessing other properties such as {@link #getTaggerIdent()} or either* message function requires reloading the buffer by invoking- * {@link RevWalk#parseBody(RevObject)}.+ * {@link org.eclipse.jgit.revwalk.RevWalk#parseBody(RevObject)}.** @since 4.0*/diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevTree.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevTree.javaindex d37040903e..e7de270f65 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevTree.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevTree.java@@ -52,7 +52,9 @@ import org.eclipse.jgit.errors.MissingObjectException;import org.eclipse.jgit.lib.AnyObjectId;import org.eclipse.jgit.lib.Constants;-/** A reference to a tree of subtrees/files. */+/**+ * A reference to a tree of subtrees/files.+ */public class RevTree extends RevObject {/*** Create a new tree reference.@@ -60,10 +62,11 @@ public class RevTree extends RevObject {* @param id* object name for the tree.*/- protected RevTree(final AnyObjectId id) {+ protected RevTree(AnyObjectId id) {super(id);}+ /** {@inheritDoc} */@Overridepublic final int getType() {return Constants.OBJ_TREE;diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.javaindex 320f05f440..4d555d2178 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevWalk.java@@ -53,6 +53,7 @@ import java.util.EnumSet;import java.util.Iterator;import java.util.List;+import org.eclipse.jgit.annotations.NonNull;import org.eclipse.jgit.errors.CorruptObjectException;import org.eclipse.jgit.errors.IncorrectObjectTypeException;import org.eclipse.jgit.errors.LargeObjectException;@@ -84,10 +85,12 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter;* usage of a RevWalk instance to a single thread, or implement their own* synchronization at a higher level.* <p>- * Multiple simultaneous RevWalk instances per {@link Repository} are permitted,- * even from concurrent threads. Equality of {@link RevCommit}s from two- * different RevWalk instances is never true, even if their {@link ObjectId}s- * are equal (and thus they describe the same commit).+ * Multiple simultaneous RevWalk instances per+ * {@link org.eclipse.jgit.lib.Repository} are permitted, even from concurrent+ * threads. Equality of {@link org.eclipse.jgit.revwalk.RevCommit}s from two+ * different RevWalk instances is never true, even if their+ * {@link org.eclipse.jgit.lib.ObjectId}s are equal (and thus they describe the+ * same commit).* <p>* The offered iterator is over the list of RevCommits described by the* configuration of this instance. Applications should restrict themselves to@@ -206,7 +209,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* ObjectReader will be created by the walker, and will be closed* when the walker is closed.*/- public RevWalk(final Repository repo) {+ public RevWalk(Repository repo) {this(repo.newObjectReader(), true);}@@ -236,12 +239,18 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {this.closeReader = closeReader;}- /** @return the reader this walker is using to load objects. */+ /**+ * Get the reader this walker is using to load objects.+ *+ * @return the reader this walker is using to load objects.+ */public ObjectReader getObjectReader() {return reader;}/**+ * {@inheritDoc}+ * <p>* Release any resources used by this walker's reader.* <p>* A walker that has been released can be used again, but may need to be@@ -272,20 +281,20 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param c* the commit to start traversing from. The commit passed must be* from this same revision walker.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the commit supplied is not available from the object* database. This usually indicates the supplied commit is* invalid, but the reference was constructed during an earlier* invocation to {@link #lookupCommit(AnyObjectId)}.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* the object was not parsed yet and it was discovered during* parsing that it is not actually a commit. This usually* indicates the caller supplied a non-commit SHA-1 to* {@link #lookupCommit(AnyObjectId)}.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public void markStart(final RevCommit c) throws MissingObjectException,+ public void markStart(RevCommit c) throws MissingObjectException,IncorrectObjectTypeException, IOException {if ((c.flags & SEEN) != 0)return;@@ -302,23 +311,23 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param list* commits to start traversing from. The commits passed must be* from this same revision walker.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* one of the commits supplied is not available from the object* database. This usually indicates the supplied commit is* invalid, but the reference was constructed during an earlier* invocation to {@link #lookupCommit(AnyObjectId)}.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* the object was not parsed yet and it was discovered during* parsing that it is not actually a commit. This usually* indicates the caller supplied a non-commit SHA-1 to* {@link #lookupCommit(AnyObjectId)}.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public void markStart(final Collection<RevCommit> list)+ public void markStart(Collection<RevCommit> list)throws MissingObjectException, IncorrectObjectTypeException,IOException {- for (final RevCommit c : list)+ for (RevCommit c : list)markStart(c);}@@ -342,20 +351,20 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param c* the commit to start traversing from. The commit passed must be* from this same revision walker.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the commit supplied is not available from the object* database. This usually indicates the supplied commit is* invalid, but the reference was constructed during an earlier* invocation to {@link #lookupCommit(AnyObjectId)}.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* the object was not parsed yet and it was discovered during* parsing that it is not actually a commit. This usually* indicates the caller supplied a non-commit SHA-1 to* {@link #lookupCommit(AnyObjectId)}.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public void markUninteresting(final RevCommit c)+ public void markUninteresting(RevCommit c)throws MissingObjectException, IncorrectObjectTypeException,IOException {c.flags |= UNINTERESTING;@@ -383,17 +392,17 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @return true if there is a path directly from <code>tip</code> to* <code>base</code> (and thus <code>base</code> is fully merged* into <code>tip</code>); false otherwise.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* one or or more of the next commit's parents are not available* from the object database, but were thought to be candidates* for traversal. This usually indicates a broken link.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* one or or more of the next commit's parents are not actually* commit objects.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public boolean isMergedInto(final RevCommit base, final RevCommit tip)+ public boolean isMergedInto(RevCommit base, RevCommit tip)throws MissingObjectException, IncorrectObjectTypeException,IOException {final RevFilter oldRF = filter;@@ -420,14 +429,14 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* Pop the next most recent commit.** @return next most recent commit; null if traversal is over.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* one or or more of the next commit's parents are not available* from the object database, but were thought to be candidates* for traversal. This usually indicates a broken link.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* one or or more of the next commit's parents are not actually* commit objects.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/public RevCommit next() throws MissingObjectException,@@ -439,7 +448,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* Obtain the sort types applied to the commits returned.** @return the sorting strategies employed. At least one strategy is always- * used, but that strategy may be {@link RevSort#NONE}.+ * used, but that strategy may be+ * {@link org.eclipse.jgit.revwalk.RevSort#NONE}.*/public EnumSet<RevSort> getRevSort() {return sorting.clone();@@ -465,7 +475,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param s* a sorting strategy to enable.*/- public void sort(final RevSort s) {+ public void sort(RevSort s) {assertNotStarted();sorting.clear();sorting.add(s);@@ -475,8 +485,9 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* Add or remove a sorting strategy for the returned commits.* <p>* Multiple strategies can be applied at once, in which case some strategies- * may take precedence over others. As an example, {@link RevSort#TOPO} must- * take precedence over {@link RevSort#COMMIT_TIME_DESC}, otherwise it+ * may take precedence over others. As an example,+ * {@link org.eclipse.jgit.revwalk.RevSort#TOPO} must take precedence over+ * {@link org.eclipse.jgit.revwalk.RevSort#COMMIT_TIME_DESC}, otherwise it* cannot enforce its ordering.** @param s@@ -485,7 +496,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* true if this strategy should be used, false if it should be* removed.*/- public void sort(final RevSort s, final boolean use) {+ public void sort(RevSort s, boolean use) {assertNotStarted();if (use)sorting.add(s);@@ -503,6 +514,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {** @return the current filter. Never null as a filter is always needed.*/+ @NonNullpublic RevFilter getRevFilter() {return filter;}@@ -518,16 +530,18 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* Note that filters are not thread-safe and may not be shared by concurrent* RevWalk instances. Every RevWalk must be supplied its own unique filter,* unless the filter implementation specifically states it is (and always- * will be) thread-safe. Callers may use {@link RevFilter#clone()} to create- * a unique filter tree for this RevWalk instance.+ * will be) thread-safe. Callers may use+ * {@link org.eclipse.jgit.revwalk.filter.RevFilter#clone()} to create a+ * unique filter tree for this RevWalk instance.** @param newFilter- * the new filter. If null the special {@link RevFilter#ALL}- * filter will be used instead, as it matches every commit.+ * the new filter. If null the special+ * {@link org.eclipse.jgit.revwalk.filter.RevFilter#ALL} filter+ * will be used instead, as it matches every commit.* @see org.eclipse.jgit.revwalk.filter.AndRevFilter* @see org.eclipse.jgit.revwalk.filter.OrRevFilter*/- public void setRevFilter(final RevFilter newFilter) {+ public void setRevFilter(RevFilter newFilter) {assertNotStarted();filter = newFilter != null ? newFilter : RevFilter.ALL;}@@ -536,8 +550,11 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* Get the tree filter used to simplify commits by modified paths.** @return the current filter. Never null as a filter is always needed. If- * no filter is being applied {@link TreeFilter#ALL} is returned.+ * no filter is being applied+ * {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} is+ * returned.*/+ @NonNullpublic TreeFilter getTreeFilter() {return treeFilter;}@@ -545,24 +562,27 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {/*** Set the tree filter used to simplify commits by modified paths.* <p>- * If null or {@link TreeFilter#ALL} the path limiter is removed. Commits- * will not be simplified.+ * If null or {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} the+ * path limiter is removed. Commits will not be simplified.* <p>- * If non-null and not {@link TreeFilter#ALL} then the tree filter will be- * installed. Commits will have their ancestry simplified to hide commits that- * do not contain tree entries matched by the filter, unless- * {@code setRewriteParents(false)} is called.+ * If non-null and not+ * {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} then the tree+ * filter will be installed. Commits will have their ancestry simplified to+ * hide commits that do not contain tree entries matched by the filter,+ * unless {@code setRewriteParents(false)} is called.* <p>* Usually callers should be inserting a filter graph including- * {@link TreeFilter#ANY_DIFF} along with one or more- * {@link org.eclipse.jgit.treewalk.filter.PathFilter} instances.+ * {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ANY_DIFF} along with+ * one or more {@link org.eclipse.jgit.treewalk.filter.PathFilter}+ * instances.** @param newFilter- * new filter. If null the special {@link TreeFilter#ALL} filter+ * new filter. If null the special+ * {@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL} filter* will be used instead, as it matches everything.* @see org.eclipse.jgit.treewalk.filter.PathFilter*/- public void setTreeFilter(final TreeFilter newFilter) {+ public void setTreeFilter(TreeFilter newFilter) {assertNotStarted();treeFilter = newFilter != null ? newFilter : TreeFilter.ALL;}@@ -571,9 +591,9 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* Set whether to rewrite parent pointers when filtering by modified paths.* <p>* By default, when {@link #setTreeFilter(TreeFilter)} is called with non-- * null and non-{@link TreeFilter#ALL} filter, commits will have their- * ancestry simplified and parents rewritten to hide commits that do not match- * the filter.+ * null and non-{@link org.eclipse.jgit.treewalk.filter.TreeFilter#ALL}+ * filter, commits will have their ancestry simplified and parents rewritten+ * to hide commits that do not match the filter.* <p>* This behavior can be bypassed by passing false to this method.*@@ -596,8 +616,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* care and would prefer to discard the body of a commit as early as* possible, to reduce memory usage.* <p>- * True by default on {@link RevWalk} and false by default for- * {@link ObjectWalk}.+ * True by default on {@link org.eclipse.jgit.revwalk.RevWalk} and false by+ * default for {@link org.eclipse.jgit.revwalk.ObjectWalk}.** @return true if the body should be retained; false it is discarded.*/@@ -608,16 +628,17 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {/*** Set whether or not the body of a commit or tag is retained.* <p>- * If a body of a commit or tag is not retained, the application must- * call {@link #parseBody(RevObject)} before the body can be safely- * accessed through the type specific access methods.+ * If a body of a commit or tag is not retained, the application must call+ * {@link #parseBody(RevObject)} before the body can be safely accessed+ * through the type specific access methods.* <p>- * True by default on {@link RevWalk} and false by default for- * {@link ObjectWalk}.+ * True by default on {@link org.eclipse.jgit.revwalk.RevWalk} and false by+ * default for {@link org.eclipse.jgit.revwalk.ObjectWalk}.*- * @param retain true to retain bodies; false to discard them early.+ * @param retain+ * true to retain bodies; false to discard them early.*/- public void setRetainBody(final boolean retain) {+ public void setRetainBody(boolean retain) {retainBody = retain;}@@ -631,7 +652,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* name of the blob object.* @return reference to the blob object. Never null.*/- public RevBlob lookupBlob(final AnyObjectId id) {+ @NonNull+ public RevBlob lookupBlob(AnyObjectId id) {RevBlob c = (RevBlob) objects.get(id);if (c == null) {c = new RevBlob(id);@@ -650,7 +672,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* name of the tree object.* @return reference to the tree object. Never null.*/- public RevTree lookupTree(final AnyObjectId id) {+ @NonNull+ public RevTree lookupTree(AnyObjectId id) {RevTree c = (RevTree) objects.get(id);if (c == null) {c = new RevTree(id);@@ -672,7 +695,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* name of the commit object.* @return reference to the commit object. Never null.*/- public RevCommit lookupCommit(final AnyObjectId id) {+ @NonNull+ public RevCommit lookupCommit(AnyObjectId id) {RevCommit c = (RevCommit) objects.get(id);if (c == null) {c = createCommit(id);@@ -691,7 +715,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* name of the tag object.* @return reference to the tag object. Never null.*/- public RevTag lookupTag(final AnyObjectId id) {+ @NonNull+ public RevTag lookupTag(AnyObjectId id) {RevTag c = (RevTag) objects.get(id);if (c == null) {c = new RevTag(id);@@ -712,7 +737,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* type of the object. Must be a valid Git object type.* @return reference to the object. Never null.*/- public RevObject lookupAny(final AnyObjectId id, final int type) {+ @NonNull+ public RevObject lookupAny(AnyObjectId id, int type) {RevObject r = objects.get(id);if (r == null) {switch (type) {@@ -759,14 +785,15 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param id* name of the commit object.* @return reference to the commit object. Never null.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the supplied commit does not exist.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* the supplied id is not a commit or an annotated tag.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public RevCommit parseCommit(final AnyObjectId id)+ @NonNull+ public RevCommit parseCommit(AnyObjectId id)throws MissingObjectException, IncorrectObjectTypeException,IOException {RevObject c = peel(parseAny(id));@@ -786,14 +813,15 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* name of the tree object, or a commit or annotated tag that may* reference a tree.* @return reference to the tree object. Never null.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the supplied tree does not exist.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* the supplied id is not a tree, a commit or an annotated tag.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public RevTree parseTree(final AnyObjectId id)+ @NonNull+ public RevTree parseTree(AnyObjectId id)throws MissingObjectException, IncorrectObjectTypeException,IOException {RevObject c = peel(parseAny(id));@@ -820,14 +848,15 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param id* name of the tag object.* @return reference to the tag object. Never null.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the supplied tag does not exist.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* the supplied id is not a tag or an annotated tag.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public RevTag parseTag(final AnyObjectId id) throws MissingObjectException,+ @NonNull+ public RevTag parseTag(AnyObjectId id) throws MissingObjectException,IncorrectObjectTypeException, IOException {RevObject c = parseAny(id);if (!(c instanceof RevTag))@@ -847,12 +876,13 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param id* name of the object.* @return reference to the object. Never null.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the supplied does not exist.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public RevObject parseAny(final AnyObjectId id)+ @NonNull+ public RevObject parseAny(AnyObjectId id)throws MissingObjectException, IOException {RevObject r = objects.get(id);if (r == null)@@ -916,8 +946,6 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {/*** Asynchronous object parsing.*- * @param <T>- * any ObjectId type.* @param objectIds* objects to open from the object store. The supplied collection* must not be modified until the queue has finished.@@ -1007,12 +1035,12 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {** @param obj* the object the caller needs to be parsed.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the supplied does not exist.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public void parseHeaders(final RevObject obj)+ public void parseHeaders(RevObject obj)throws MissingObjectException, IOException {if ((obj.flags & PARSED) == 0)obj.parseHeaders(this);@@ -1026,12 +1054,12 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {** @param obj* the object the caller needs to be parsed.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* the supplied does not exist.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/- public void parseBody(final RevObject obj)+ public void parseBody(RevObject obj)throws MissingObjectException, IOException {obj.parseBody(this);}@@ -1044,9 +1072,9 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @return If {@code obj} is not an annotated tag, {@code obj}. Otherwise* the first non-tag object that {@code obj} references. The* returned object's headers have been parsed.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* a referenced object cannot be found.- * @throws IOException+ * @throws java.io.IOException* a pack file or loose object could not be read.*/public RevObject peel(RevObject obj) throws MissingObjectException,@@ -1069,10 +1097,10 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param name* description of the flag, primarily useful for debugging.* @return newly constructed flag instance.- * @throws IllegalArgumentException+ * @throws java.lang.IllegalArgumentException* too many flags have been reserved on this revision walker.*/- public RevFlag newFlag(final String name) {+ public RevFlag newFlag(String name) {final int m = allocFlag();return new RevFlag(this, name, m);}@@ -1096,7 +1124,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param flag* the flag to carry onto parents, if set on a descendant.*/- public void carry(final RevFlag flag) {+ public void carry(RevFlag flag) {if ((freeFlags & flag.mask) != 0)throw new IllegalArgumentException(MessageFormat.format(JGitText.get().flagIsDisposed, flag.name));if (flag.walker != this)@@ -1113,8 +1141,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param set* the flags to carry onto parents, if set on a descendant.*/- public void carry(final Collection<RevFlag> set) {- for (final RevFlag flag : set)+ public void carry(Collection<RevFlag> set) {+ for (RevFlag flag : set)carry(flag);}@@ -1172,11 +1200,11 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* @param flag* the to recycle.*/- public void disposeFlag(final RevFlag flag) {+ public void disposeFlag(RevFlag flag) {freeFlag(flag.mask);}- void freeFlag(final int mask) {+ void freeFlag(int mask) {retainOnReset &= ~mask;if (isNotStarted()) {freeFlags |= mask;@@ -1216,7 +1244,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* application flags that should <b>not</b> be cleared from* existing commit objects.*/- public final void resetRetain(final RevFlagSet retainFlags) {+ public final void resetRetain(RevFlagSet retainFlags) {reset(retainFlags.mask);}@@ -1234,9 +1262,9 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* application flags that should <b>not</b> be cleared from* existing commit objects.*/- public final void resetRetain(final RevFlag... retainFlags) {+ public final void resetRetain(RevFlag... retainFlags) {int mask = 0;- for (final RevFlag flag : retainFlags)+ for (RevFlag flag : retainFlags)mask |= flag.mask;reset(mask);}@@ -1258,7 +1286,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {final int clearFlags = ~retainFlags;final FIFORevQueue q = new FIFORevQueue();- for (final RevCommit c : roots) {+ for (RevCommit c : roots) {if ((c.flags & clearFlags) == 0)continue;c.flags &= retainFlags;@@ -1272,7 +1300,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {break;if (c.parents == null)continue;- for (final RevCommit p : c.parents) {+ for (RevCommit p : c.parents) {if ((p.flags & clearFlags) == 0)continue;p.flags &= retainFlags;@@ -1308,6 +1336,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {}/**+ * {@inheritDoc}+ * <p>* Returns an Iterator over the commits of this walker.* <p>* The returned iterator is only useful for one walk. If this RevWalk gets@@ -1316,10 +1346,9 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* Applications must not use both the Iterator and the {@link #next()} API* at the same time. Pick one API and use that for the entire walk.* <p>- * If a checked exception is thrown during the walk (see {@link #next()})- * it is rethrown from the Iterator as a {@link RevWalkException}.+ * If a checked exception is thrown during the walk (see {@link #next()}) it+ * is rethrown from the Iterator as a {@link RevWalkException}.*- * @return an iterator over this walker's commits.* @see RevWalkException*/@Override@@ -1365,7 +1394,9 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {};}- /** Throws an exception if we have started producing output. */+ /**+ * Throws an exception if we have started producing output.+ */protected void assertNotStarted() {if (isNotStarted())return;@@ -1377,7 +1408,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {}/**- * Create and return an {@link ObjectWalk} using the same objects.+ * Create and return an {@link org.eclipse.jgit.revwalk.ObjectWalk} using+ * the same objects.* <p>* Prior to using this method, the caller must reset this RevWalk to clean* any flags that were used during the last traversal.@@ -1403,11 +1435,11 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {* the object this walker requires a commit reference for.* @return a new unparsed reference for the object.*/- protected RevCommit createCommit(final AnyObjectId id) {+ protected RevCommit createCommit(AnyObjectId id) {return new RevCommit(id);}- void carryFlagsImpl(final RevCommit c) {+ void carryFlagsImpl(RevCommit c) {final int carry = c.flags & carryFlags;if (carry != 0)RevCommit.carryFlags(c, carry);@@ -1428,17 +1460,44 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable {lookupCommit(id).parents = RevCommit.NO_PARENTS;}- void initializeShallowCommits() throws IOException {- if (shallowCommitsInitialized)+ /**+ * Reads the "shallow" file and applies it by setting the parents of shallow+ * commits to an empty array.+ * <p>+ * There is a sequencing problem if the first commit being parsed is a+ * shallow commit, since {@link RevCommit#parseCanonical(RevWalk, byte[])}+ * calls this method before its callers add the new commit to the+ * {@link RevWalk#objects} map. That means a call from this method to+ * {@link #lookupCommit(AnyObjectId)} fails to find that commit and creates+ * a new one, which is promptly discarded.+ * <p>+ * To avoid that, {@link RevCommit#parseCanonical(RevWalk, byte[])} passes+ * its commit to this method, so that this method can apply the shallow+ * state to it directly and avoid creating the duplicate commit object.+ *+ * @param rc+ * the initial commit being parsed+ * @throws IOException+ * if the shallow commits file can't be read+ */+ void initializeShallowCommits(RevCommit rc) throws IOException {+ if (shallowCommitsInitialized) {throw new IllegalStateException(JGitText.get().shallowCommitsAlreadyInitialized);+ }shallowCommitsInitialized = true;- if (reader == null)+ if (reader == null) {return;+ }- for (ObjectId id : reader.getShallowCommits())- lookupCommit(id).parents = RevCommit.NO_PARENTS;+ for (ObjectId id : reader.getShallowCommits()) {+ if (id.equals(rc.getId())) {+ rc.parents = RevCommit.NO_PARENTS;+ } else {+ lookupCommit(id).parents = RevCommit.NO_PARENTS;+ }+ }}}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RevWalkUtils.java b/core/src/main/java/org/eclipse/jgit/revwalk/RevWalkUtils.javaindex e751d7714c..f1252a4c4b 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RevWalkUtils.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RevWalkUtils.java@@ -53,7 +53,7 @@ import org.eclipse.jgit.errors.MissingObjectException;import org.eclipse.jgit.lib.Ref;/**- * Utility methods for {@link RevWalk}.+ * Utility methods for {@link org.eclipse.jgit.revwalk.RevWalk}.*/public final class RevWalkUtils {@@ -67,9 +67,10 @@ public final class RevWalkUtils {* other words, count the number of commits that are in <code>start</code>,* but not in <code>end</code>.* <p>- * Note that this method calls {@link RevWalk#reset()} at the beginning.- * Also note that the existing rev filter on the walk is left as-is, so be- * sure to set the right rev filter before calling this method.+ * Note that this method calls+ * {@link org.eclipse.jgit.revwalk.RevWalk#reset()} at the beginning. Also+ * note that the existing rev filter on the walk is left as-is, so be sure+ * to set the right rev filter before calling this method.** @param walk* the rev walk to use@@ -78,11 +79,10 @@ public final class RevWalkUtils {* @param end* the commit where counting should end, or null if counting* should be done until there are no more commits- ** @return the number of commits- * @throws MissingObjectException- * @throws IncorrectObjectTypeException- * @throws IOException+ * @throws org.eclipse.jgit.errors.MissingObjectException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException+ * @throws java.io.IOException*/public static int count(final RevWalk walk, final RevCommit start,final RevCommit end) throws MissingObjectException,@@ -96,9 +96,10 @@ public final class RevWalkUtils {* Find of commits that are in <code>start</code>, but not in* <code>end</code>.* <p>- * Note that this method calls {@link RevWalk#reset()} at the beginning.- * Also note that the existing rev filter on the walk is left as-is, so be- * sure to set the right rev filter before calling this method.+ * Note that this method calls+ * {@link org.eclipse.jgit.revwalk.RevWalk#reset()} at the beginning. Also+ * note that the existing rev filter on the walk is left as-is, so be sure+ * to set the right rev filter before calling this method.** @param walk* the rev walk to use@@ -108,9 +109,9 @@ public final class RevWalkUtils {* the commit where counting should end, or null if counting* should be done until there are no more commits* @return the commits found- * @throws MissingObjectException- * @throws IncorrectObjectTypeException- * @throws IOException+ * @throws org.eclipse.jgit.errors.MissingObjectException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException+ * @throws java.io.IOException*/public static List<RevCommit> find(final RevWalk walk,final RevCommit start, final RevCommit end)@@ -131,7 +132,8 @@ public final class RevWalkUtils {* Find the list of branches a given commit is reachable from when following* parent.s* <p>- * Note that this method calls {@link RevWalk#reset()} at the beginning.+ * Note that this method calls+ * {@link org.eclipse.jgit.revwalk.RevWalk#reset()} at the beginning.* <p>* In order to improve performance this method assumes clock skew among* committers is never larger than 24 hours.@@ -143,9 +145,9 @@ public final class RevWalkUtils {* @param refs* the set of branches we want to see reachability from* @return the list of branches a given commit is reachable from- * @throws MissingObjectException- * @throws IncorrectObjectTypeException- * @throws IOException+ * @throws org.eclipse.jgit.errors.MissingObjectException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException+ * @throws java.io.IOException*/public static List<Ref> findBranchesReachableFrom(RevCommit commit,RevWalk revWalk, Collection<Ref> refs)diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/RewriteGenerator.java b/core/src/main/java/org/eclipse/jgit/revwalk/RewriteGenerator.javaindex 3ab96ca228..1c868ffe08 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/RewriteGenerator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/RewriteGenerator.java@@ -76,12 +76,12 @@ class RewriteGenerator extends Generator {private final Generator source;- RewriteGenerator(final Generator s) {+ RewriteGenerator(Generator s) {source = s;}@Override- void shareFreeList(final BlockRevQueue q) {+ void shareFreeList(BlockRevQueue q) {source.shareFreeList(q);}@@ -93,27 +93,25 @@ class RewriteGenerator extends Generator {@OverrideRevCommit next() throws MissingObjectException,IncorrectObjectTypeException, IOException {- for (;;) {- final RevCommit c = source.next();- if (c == null)- return null;-- boolean rewrote = false;- final RevCommit[] pList = c.parents;- final int nParents = pList.length;- for (int i = 0; i < nParents; i++) {- final RevCommit oldp = pList[i];- final RevCommit newp = rewrite(oldp);- if (oldp != newp) {- pList[i] = newp;- rewrote = true;- }+ final RevCommit c = source.next();+ if (c == null) {+ return null;+ }+ boolean rewrote = false;+ final RevCommit[] pList = c.parents;+ final int nParents = pList.length;+ for (int i = 0; i < nParents; i++) {+ final RevCommit oldp = pList[i];+ final RevCommit newp = rewrite(oldp);+ if (oldp != newp) {+ pList[i] = newp;+ rewrote = true;}- if (rewrote)- c.parents = cleanup(pList);-- return c;}+ if (rewrote) {+ c.parents = cleanup(pList);+ }+ return c;}private RevCommit rewrite(RevCommit p) {@@ -150,7 +148,7 @@ class RewriteGenerator extends Generator {}}- private RevCommit[] cleanup(final RevCommit[] oldList) {+ private RevCommit[] cleanup(RevCommit[] oldList) {// Remove any duplicate parents caused due to rewrites (e.g. a merge// with two sides that both simplified back into the merge base).// We also may have deleted a parent by marking it null.@@ -169,14 +167,14 @@ class RewriteGenerator extends Generator {}if (newCnt == oldList.length) {- for (final RevCommit p : oldList)+ for (RevCommit p : oldList)p.flags &= ~DUPLICATE;return oldList;}final RevCommit[] newList = new RevCommit[newCnt];newCnt = 0;- for (final RevCommit p : oldList) {+ for (RevCommit p : oldList) {if (p != null) {newList[newCnt++] = p;p.flags &= ~DUPLICATE;diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/StartGenerator.java b/core/src/main/java/org/eclipse/jgit/revwalk/StartGenerator.javaindex 1ec6290317..eb129a2631 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/StartGenerator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/StartGenerator.java@@ -66,7 +66,7 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter;class StartGenerator extends Generator {private final RevWalk walker;- StartGenerator(final RevWalk w) {+ StartGenerator(RevWalk w) {walker = w;}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/TopoSortGenerator.java b/core/src/main/java/org/eclipse/jgit/revwalk/TopoSortGenerator.javaindex 7b11d04901..645034351f 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/TopoSortGenerator.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/TopoSortGenerator.java@@ -69,7 +69,7 @@ class TopoSortGenerator extends Generator {* @throws IncorrectObjectTypeException* @throws IOException*/- TopoSortGenerator(final Generator s) throws MissingObjectException,+ TopoSortGenerator(Generator s) throws MissingObjectException,IncorrectObjectTypeException, IOException {pending = new FIFORevQueue();outputType = s.outputType() | SORT_TOPO;@@ -78,7 +78,7 @@ class TopoSortGenerator extends Generator {final RevCommit c = s.next();if (c == null)break;- for (final RevCommit p : c.parents)+ for (RevCommit p : c.parents)p.inDegree++;pending.add(c);}@@ -90,7 +90,7 @@ class TopoSortGenerator extends Generator {}@Override- void shareFreeList(final BlockRevQueue q) {+ void shareFreeList(BlockRevQueue q) {q.shareFreeList(pending);}@@ -113,7 +113,7 @@ class TopoSortGenerator extends Generator {// All of our children have already produced,// so it is OK for us to produce now as well.//- for (final RevCommit p : c.parents) {+ for (RevCommit p : c.parents) {if (--p.inDegree == 0 && (p.flags & TOPO_DELAY) != 0) {// This parent tried to come before us, but we are// his last child. unpop the parent so it goes rightdiff --git a/core/src/main/java/org/eclipse/jgit/revwalk/TreeRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/TreeRevFilter.javaindex e561c62a80..16835536fa 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/TreeRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/TreeRevFilter.java@@ -60,10 +60,12 @@ import org.eclipse.jgit.treewalk.TreeWalk;import org.eclipse.jgit.treewalk.filter.TreeFilter;/**- * Filter applying a {@link TreeFilter} against changed paths in each commit.+ * Filter applying a {@link org.eclipse.jgit.treewalk.filter.TreeFilter} against+ * changed paths in each commit.* <p>* Each commit is differenced concurrently against all of its parents to look- * for tree entries that are interesting to the {@link TreeFilter}.+ * for tree entries that are interesting to the+ * {@link org.eclipse.jgit.treewalk.filter.TreeFilter}.** @since 3.5*/@@ -76,17 +78,18 @@ public class TreeRevFilter extends RevFilter {private final TreeWalk pathFilter;/**- * Create a {@link RevFilter} from a {@link TreeFilter}.+ * Create a {@link org.eclipse.jgit.revwalk.filter.RevFilter} from a+ * {@link org.eclipse.jgit.treewalk.filter.TreeFilter}.** @param walker* walker used for reading trees.* @param t- * filter to compare against any changed paths in each commit. If a- * {@link FollowFilter}, will be replaced with a new filter- * following new paths after a rename.+ * filter to compare against any changed paths in each commit. If+ * a {@link org.eclipse.jgit.revwalk.FollowFilter}, will be+ * replaced with a new filter following new paths after a rename.* @since 3.5*/- public TreeRevFilter(final RevWalk walker, final TreeFilter t) {+ public TreeRevFilter(RevWalk walker, TreeFilter t) {this(walker, t, 0);}@@ -121,13 +124,15 @@ public class TreeRevFilter extends RevFilter {this.rewriteFlag = rewriteFlag;}+ /** {@inheritDoc} */@Overridepublic RevFilter clone() {throw new UnsupportedOperationException();}+ /** {@inheritDoc} */@Override- public boolean include(final RevWalk walker, final RevCommit c)+ public boolean include(RevWalk walker, RevCommit c)throws StopWalkException, MissingObjectException,IncorrectObjectTypeException, IOException {// Reset the tree filter to scan this commit and parents.@@ -263,6 +268,7 @@ public class TreeRevFilter extends RevFilter {return false;}+ /** {@inheritDoc} */@Overridepublic boolean requiresCommitBody() {return false;diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/AndRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/AndRevFilter.javaindex 4a91493dc0..dfb83b491a 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/AndRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/AndRevFilter.java@@ -57,9 +57,10 @@ import org.eclipse.jgit.revwalk.RevWalk;* Includes a commit only if all subfilters include the same commit.* <p>* Classic shortcut behavior is used, so evaluation of the- * {@link RevFilter#include(RevWalk, RevCommit)} method stops as soon as a false- * result is obtained. Applications can improve filtering performance by placing- * faster filters that are more likely to reject a result earlier in the list.+ * {@link org.eclipse.jgit.revwalk.filter.RevFilter#include(RevWalk, RevCommit)}+ * method stops as soon as a false result is obtained. Applications can improve+ * filtering performance by placing faster filters that are more likely to+ * reject a result earlier in the list.*/public abstract class AndRevFilter extends RevFilter {/**@@ -71,7 +72,7 @@ public abstract class AndRevFilter extends RevFilter {* second filter to test.* @return a filter that must match both input filters.*/- public static RevFilter create(final RevFilter a, final RevFilter b) {+ public static RevFilter create(RevFilter a, RevFilter b) {if (a == ALL)return b;if (b == ALL)@@ -87,7 +88,7 @@ public abstract class AndRevFilter extends RevFilter {* filters.* @return a filter that must match all input filters.*/- public static RevFilter create(final RevFilter[] list) {+ public static RevFilter create(RevFilter[] list) {if (list.length == 2)return create(list[0], list[1]);if (list.length < 2)@@ -105,7 +106,7 @@ public abstract class AndRevFilter extends RevFilter {* filters.* @return a filter that must match all input filters.*/- public static RevFilter create(final Collection<RevFilter> list) {+ public static RevFilter create(Collection<RevFilter> list) {if (list.size() < 2)throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);final RevFilter[] subfilters = new RevFilter[list.size()];@@ -122,7 +123,7 @@ public abstract class AndRevFilter extends RevFilter {private final boolean requiresCommitBody;- Binary(final RevFilter one, final RevFilter two) {+ Binary(RevFilter one, RevFilter two) {a = one;b = two;requiresCommitBody = a.requiresCommitBody()@@ -130,7 +131,7 @@ public abstract class AndRevFilter extends RevFilter {}@Override- public boolean include(final RevWalk walker, final RevCommit c)+ public boolean include(RevWalk walker, RevCommit c)throws MissingObjectException, IncorrectObjectTypeException,IOException {return a.include(walker, c) && b.include(walker, c);@@ -158,7 +159,7 @@ public abstract class AndRevFilter extends RevFilter {private final boolean requiresCommitBody;- List(final RevFilter[] list) {+ List(RevFilter[] list) {subfilters = list;boolean rcb = false;@@ -168,10 +169,10 @@ public abstract class AndRevFilter extends RevFilter {}@Override- public boolean include(final RevWalk walker, final RevCommit c)+ public boolean include(RevWalk walker, RevCommit c)throws MissingObjectException, IncorrectObjectTypeException,IOException {- for (final RevFilter f : subfilters) {+ for (RevFilter f : subfilters) {if (!f.include(walker, c))return false;}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.javaindex ef0064b238..334d4f0144 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java@@ -50,7 +50,9 @@ import org.eclipse.jgit.revwalk.RevCommit;import org.eclipse.jgit.util.RawCharSequence;import org.eclipse.jgit.util.RawParseUtils;-/** Matches only commits whose author name matches the pattern. */+/**+ * Matches only commits whose author name matches the pattern.+ */public class AuthorRevFilter {/*** Create a new author filter.@@ -79,7 +81,7 @@ public class AuthorRevFilter {// Don't permit us to be created.}- static RawCharSequence textFor(final RevCommit cmit) {+ static RawCharSequence textFor(RevCommit cmit) {final byte[] raw = cmit.getRawBuffer();final int b = RawParseUtils.author(raw, 0);if (b < 0)@@ -89,12 +91,12 @@ public class AuthorRevFilter {}private static class PatternSearch extends PatternMatchRevFilter {- PatternSearch(final String patternText) {+ PatternSearch(String patternText) {super(patternText, true, true, Pattern.CASE_INSENSITIVE);}@Override- protected CharSequence text(final RevCommit cmit) {+ protected CharSequence text(RevCommit cmit) {return textFor(cmit);}@@ -105,12 +107,12 @@ public class AuthorRevFilter {}private static class SubStringSearch extends SubStringRevFilter {- SubStringSearch(final String patternText) {+ SubStringSearch(String patternText) {super(patternText);}@Override- protected RawCharSequence text(final RevCommit cmit) {+ protected RawCharSequence text(RevCommit cmit) {return textFor(cmit);}}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.javaindex 5bf9366ded..38805153ef 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java@@ -53,7 +53,9 @@ import org.eclipse.jgit.errors.StopWalkException;import org.eclipse.jgit.revwalk.RevCommit;import org.eclipse.jgit.revwalk.RevWalk;-/** Selects commits based upon the commit time field. */+/**+ * Selects commits based upon the commit time field.+ */public abstract class CommitTimeRevFilter extends RevFilter {/*** Create a new filter to select commits before a given date/time.@@ -62,7 +64,7 @@ public abstract class CommitTimeRevFilter extends RevFilter {* the point in time to cut on.* @return a new filter to select commits on or before <code>ts</code>.*/- public static final RevFilter before(final Date ts) {+ public static final RevFilter before(Date ts) {return before(ts.getTime());}@@ -73,7 +75,7 @@ public abstract class CommitTimeRevFilter extends RevFilter {* the point in time to cut on, in milliseconds* @return a new filter to select commits on or before <code>ts</code>.*/- public static final RevFilter before(final long ts) {+ public static final RevFilter before(long ts) {return new Before(ts);}@@ -84,7 +86,7 @@ public abstract class CommitTimeRevFilter extends RevFilter {* the point in time to cut on.* @return a new filter to select commits on or after <code>ts</code>.*/- public static final RevFilter after(final Date ts) {+ public static final RevFilter after(Date ts) {return after(ts.getTime());}@@ -95,7 +97,7 @@ public abstract class CommitTimeRevFilter extends RevFilter {* the point in time to cut on, in milliseconds.* @return a new filter to select commits on or after <code>ts</code>.*/- public static final RevFilter after(final long ts) {+ public static final RevFilter after(long ts) {return new After(ts);}@@ -107,7 +109,7 @@ public abstract class CommitTimeRevFilter extends RevFilter {* @param until the point in time to cut off.* @return a new filter to select commits between the given date/times.*/- public static final RevFilter between(final Date since, final Date until) {+ public static final RevFilter between(Date since, Date until) {return between(since.getTime(), until.getTime());}@@ -119,33 +121,35 @@ public abstract class CommitTimeRevFilter extends RevFilter {* @param until the point in time to cut off, in millisconds.* @return a new filter to select commits between the given date/times.*/- public static final RevFilter between(final long since, final long until) {+ public static final RevFilter between(long since, long until) {return new Between(since, until);}final int when;- CommitTimeRevFilter(final long ts) {+ CommitTimeRevFilter(long ts) {when = (int) (ts / 1000);}+ /** {@inheritDoc} */@Overridepublic RevFilter clone() {return this;}+ /** {@inheritDoc} */@Overridepublic boolean requiresCommitBody() {return false;}private static class Before extends CommitTimeRevFilter {- Before(final long ts) {+ Before(long ts) {super(ts);}@Override- public boolean include(final RevWalk walker, final RevCommit cmit)+ public boolean include(RevWalk walker, RevCommit cmit)throws StopWalkException, MissingObjectException,IncorrectObjectTypeException, IOException {return cmit.getCommitTime() <= when;@@ -159,12 +163,12 @@ public abstract class CommitTimeRevFilter extends RevFilter {}private static class After extends CommitTimeRevFilter {- After(final long ts) {+ After(long ts) {super(ts);}@Override- public boolean include(final RevWalk walker, final RevCommit cmit)+ public boolean include(RevWalk walker, RevCommit cmit)throws StopWalkException, MissingObjectException,IncorrectObjectTypeException, IOException {// Since the walker sorts commits by commit time we can be@@ -186,13 +190,13 @@ public abstract class CommitTimeRevFilter extends RevFilter {private static class Between extends CommitTimeRevFilter {private final int until;- Between(final long since, final long until) {+ Between(long since, long until) {super(since);this.until = (int) (until / 1000);}@Override- public boolean include(final RevWalk walker, final RevCommit cmit)+ public boolean include(RevWalk walker, RevCommit cmit)throws StopWalkException, MissingObjectException,IncorrectObjectTypeException, IOException {return cmit.getCommitTime() <= until && cmit.getCommitTime() >= when;diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.javaindex eedfef215c..37c840e379 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java@@ -50,7 +50,9 @@ import org.eclipse.jgit.revwalk.RevCommit;import org.eclipse.jgit.util.RawCharSequence;import org.eclipse.jgit.util.RawParseUtils;-/** Matches only commits whose committer name matches the pattern. */+/**+ * Matches only commits whose committer name matches the pattern.+ */public class CommitterRevFilter {/*** Create a new committer filter.@@ -79,7 +81,7 @@ public class CommitterRevFilter {// Don't permit us to be created.}- static RawCharSequence textFor(final RevCommit cmit) {+ static RawCharSequence textFor(RevCommit cmit) {final byte[] raw = cmit.getRawBuffer();final int b = RawParseUtils.committer(raw, 0);if (b < 0)@@ -89,12 +91,12 @@ public class CommitterRevFilter {}private static class PatternSearch extends PatternMatchRevFilter {- PatternSearch(final String patternText) {+ PatternSearch(String patternText) {super(patternText, true, true, Pattern.CASE_INSENSITIVE);}@Override- protected CharSequence text(final RevCommit cmit) {+ protected CharSequence text(RevCommit cmit) {return textFor(cmit);}@@ -105,12 +107,12 @@ public class CommitterRevFilter {}private static class SubStringSearch extends SubStringRevFilter {- SubStringSearch(final String patternText) {+ SubStringSearch(String patternText) {super(patternText);}@Override- protected RawCharSequence text(final RevCommit cmit) {+ protected RawCharSequence text(RevCommit cmit) {return textFor(cmit);}}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/MaxCountRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/MaxCountRevFilter.javaindex 38b0da5286..02c6670758 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/MaxCountRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/MaxCountRevFilter.java@@ -79,6 +79,7 @@ public class MaxCountRevFilter extends RevFilter {this.maxCount = maxCount;}+ /** {@inheritDoc} */@Overridepublic boolean include(RevWalk walker, RevCommit cmit)throws StopWalkException, MissingObjectException,@@ -89,6 +90,7 @@ public class MaxCountRevFilter extends RevFilter {return true;}+ /** {@inheritDoc} */@Overridepublic RevFilter clone() {return new MaxCountRevFilter(maxCount);diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/MessageRevFilter.javaindex a7cc5bdc10..480aaa38eb 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java@@ -50,7 +50,9 @@ import org.eclipse.jgit.revwalk.RevCommit;import org.eclipse.jgit.util.RawCharSequence;import org.eclipse.jgit.util.RawParseUtils;-/** Matches only commits whose message matches the pattern. */+/**+ * Matches only commits whose message matches the pattern.+ */public class MessageRevFilter {/*** Create a message filter.@@ -79,7 +81,7 @@ public class MessageRevFilter {// Don't permit us to be created.}- static RawCharSequence textFor(final RevCommit cmit) {+ static RawCharSequence textFor(RevCommit cmit) {final byte[] raw = cmit.getRawBuffer();final int b = RawParseUtils.commitMessage(raw, 0);if (b < 0)@@ -88,13 +90,13 @@ public class MessageRevFilter {}private static class PatternSearch extends PatternMatchRevFilter {- PatternSearch(final String patternText) {+ PatternSearch(String patternText) {super(patternText, true, true, Pattern.CASE_INSENSITIVE| Pattern.DOTALL);}@Override- protected CharSequence text(final RevCommit cmit) {+ protected CharSequence text(RevCommit cmit) {return textFor(cmit);}@@ -105,12 +107,12 @@ public class MessageRevFilter {}private static class SubStringSearch extends SubStringRevFilter {- SubStringSearch(final String patternText) {+ SubStringSearch(String patternText) {super(patternText);}@Override- protected RawCharSequence text(final RevCommit cmit) {+ protected RawCharSequence text(RevCommit cmit) {return textFor(cmit);}}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/NotRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/NotRevFilter.javaindex d3388021ba..69dec567b8 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/NotRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/NotRevFilter.java@@ -50,7 +50,9 @@ import org.eclipse.jgit.errors.MissingObjectException;import org.eclipse.jgit.revwalk.RevCommit;import org.eclipse.jgit.revwalk.RevWalk;-/** Includes a commit only if the subfilter does not include the commit. */+/**+ * Includes a commit only if the subfilter does not include the commit.+ */public class NotRevFilter extends RevFilter {/*** Create a filter that negates the result of another filter.@@ -59,38 +61,43 @@ public class NotRevFilter extends RevFilter {* filter to negate.* @return a filter that does the reverse of <code>a</code>.*/- public static RevFilter create(final RevFilter a) {+ public static RevFilter create(RevFilter a) {return new NotRevFilter(a);}private final RevFilter a;- private NotRevFilter(final RevFilter one) {+ private NotRevFilter(RevFilter one) {a = one;}+ /** {@inheritDoc} */@Overridepublic RevFilter negate() {return a;}+ /** {@inheritDoc} */@Override- public boolean include(final RevWalk walker, final RevCommit c)+ public boolean include(RevWalk walker, RevCommit c)throws MissingObjectException, IncorrectObjectTypeException,IOException {return !a.include(walker, c);}+ /** {@inheritDoc} */@Overridepublic boolean requiresCommitBody() {return a.requiresCommitBody();}+ /** {@inheritDoc} */@Overridepublic RevFilter clone() {return new NotRevFilter(a.clone());}+ /** {@inheritDoc} */@Overridepublic String toString() {return "NOT " + a.toString(); //$NON-NLS-1$diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/ObjectFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/ObjectFilter.javaindex 2ad273d9ec..777e4e01c5 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/ObjectFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/ObjectFilter.java@@ -54,7 +54,8 @@ import org.eclipse.jgit.revwalk.ObjectWalk;* Selects interesting objects when walking.* <p>* Applications should install the filter on an ObjectWalk by- * {@link ObjectWalk#setObjectFilter(ObjectFilter)} prior to starting traversal.+ * {@link org.eclipse.jgit.revwalk.ObjectWalk#setObjectFilter(ObjectFilter)}+ * prior to starting traversal.** @since 4.0*/@@ -77,13 +78,13 @@ public abstract class ObjectFilter {* @param objid* the object currently being tested.* @return {@code true} if the named object should be included in the walk.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* an object the filter needed to consult to determine its* answer was missing- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* an object the filter needed to consult to determine its* answer was of the wrong type- * @throws IOException+ * @throws java.io.IOException* an object the filter needed to consult to determine its* answer could not be read.*/diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/OrRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/OrRevFilter.javaindex 4c7b3bf47e..1cef12f79c 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/OrRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/OrRevFilter.java@@ -57,9 +57,10 @@ import org.eclipse.jgit.revwalk.RevWalk;* Includes a commit if any subfilters include the same commit.* <p>* Classic shortcut behavior is used, so evaluation of the- * {@link RevFilter#include(RevWalk, RevCommit)} method stops as soon as a true- * result is obtained. Applications can improve filtering performance by placing- * faster filters that are more likely to accept a result earlier in the list.+ * {@link org.eclipse.jgit.revwalk.filter.RevFilter#include(RevWalk, RevCommit)}+ * method stops as soon as a true result is obtained. Applications can improve+ * filtering performance by placing faster filters that are more likely to+ * accept a result earlier in the list.*/public abstract class OrRevFilter extends RevFilter {/**@@ -71,7 +72,7 @@ public abstract class OrRevFilter extends RevFilter {* second filter to test.* @return a filter that must match at least one input filter.*/- public static RevFilter create(final RevFilter a, final RevFilter b) {+ public static RevFilter create(RevFilter a, RevFilter b) {if (a == ALL || b == ALL)return ALL;return new Binary(a, b);@@ -85,7 +86,7 @@ public abstract class OrRevFilter extends RevFilter {* filters.* @return a filter that must match at least one input filter.*/- public static RevFilter create(final RevFilter[] list) {+ public static RevFilter create(RevFilter[] list) {if (list.length == 2)return create(list[0], list[1]);if (list.length < 2)@@ -103,7 +104,7 @@ public abstract class OrRevFilter extends RevFilter {* filters.* @return a filter that must match at least one input filter.*/- public static RevFilter create(final Collection<RevFilter> list) {+ public static RevFilter create(Collection<RevFilter> list) {if (list.size() < 2)throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);final RevFilter[] subfilters = new RevFilter[list.size()];@@ -120,7 +121,7 @@ public abstract class OrRevFilter extends RevFilter {private final boolean requiresCommitBody;- Binary(final RevFilter one, final RevFilter two) {+ Binary(RevFilter one, RevFilter two) {a = one;b = two;requiresCommitBody = a.requiresCommitBody()@@ -128,7 +129,7 @@ public abstract class OrRevFilter extends RevFilter {}@Override- public boolean include(final RevWalk walker, final RevCommit c)+ public boolean include(RevWalk walker, RevCommit c)throws MissingObjectException, IncorrectObjectTypeException,IOException {return a.include(walker, c) || b.include(walker, c);@@ -156,7 +157,7 @@ public abstract class OrRevFilter extends RevFilter {private final boolean requiresCommitBody;- List(final RevFilter[] list) {+ List(RevFilter[] list) {subfilters = list;boolean rcb = false;@@ -166,10 +167,10 @@ public abstract class OrRevFilter extends RevFilter {}@Override- public boolean include(final RevWalk walker, final RevCommit c)+ public boolean include(RevWalk walker, RevCommit c)throws MissingObjectException, IncorrectObjectTypeException,IOException {- for (final RevFilter f : subfilters) {+ for (RevFilter f : subfilters) {if (f.include(walker, c))return true;}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.javaindex 1dd4555e5a..4f41edf54d 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java@@ -54,9 +54,10 @@ import org.eclipse.jgit.internal.JGitText;import org.eclipse.jgit.lib.Constants;import org.eclipse.jgit.revwalk.RevCommit;import org.eclipse.jgit.revwalk.RevWalk;-import org.eclipse.jgit.util.RawCharSequence;-/** Abstract filter that searches text using extended regular expressions. */+/**+ * Abstract filter that searches text using extended regular expressions.+ */public abstract class PatternMatchRevFilter extends RevFilter {/*** Encode a string pattern for faster matching on byte arrays.@@ -69,9 +70,9 @@ public abstract class PatternMatchRevFilter extends RevFilter {* original pattern string supplied by the user or the* application.* @return same pattern, but re-encoded to match our funny raw UTF-8- * character sequence {@link RawCharSequence}.+ * character sequence {@link org.eclipse.jgit.util.RawCharSequence}.*/- protected static final String forceToRaw(final String patternText) {+ protected static final String forceToRaw(String patternText) {final byte[] b = Constants.encode(patternText);final StringBuilder needle = new StringBuilder(b.length);for (int i = 0; i < b.length; i++)@@ -97,7 +98,8 @@ public abstract class PatternMatchRevFilter extends RevFilter {* should {@link #forceToRaw(String)} be applied to the pattern* before compiling it?* @param flags- * flags from {@link Pattern} to control how matching performs.+ * flags from {@link java.util.regex.Pattern} to control how+ * matching performs.*/protected PatternMatchRevFilter(String pattern, final boolean innerString,final boolean rawEncoding, final int flags) {@@ -124,13 +126,15 @@ public abstract class PatternMatchRevFilter extends RevFilter {return patternText;}+ /** {@inheritDoc} */@Override- public boolean include(final RevWalk walker, final RevCommit cmit)+ public boolean include(RevWalk walker, RevCommit cmit)throws MissingObjectException, IncorrectObjectTypeException,IOException {return compiledPattern.reset(text(cmit)).matches();}+ /** {@inheritDoc} */@Overridepublic boolean requiresCommitBody() {return true;@@ -145,6 +149,7 @@ public abstract class PatternMatchRevFilter extends RevFilter {*/protected abstract CharSequence text(RevCommit cmit);+ /** {@inheritDoc} */@SuppressWarnings("nls")@Overridepublic String toString() {diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/RevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/RevFilter.javaindex 6b90d29f1c..39f0d60166 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/RevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/RevFilter.java@@ -61,7 +61,8 @@ import org.eclipse.jgit.revwalk.RevWalk;* <code>OrRevFilter</code> to create complex boolean expressions.* <p>* Applications should install the filter on a RevWalk by- * {@link RevWalk#setRevFilter(RevFilter)} prior to starting traversal.+ * {@link org.eclipse.jgit.revwalk.RevWalk#setRevFilter(RevFilter)} prior to+ * starting traversal.* <p>* Unless specifically noted otherwise a RevFilter implementation is not thread* safe and may not be shared by different RevWalk instances at the same time.@@ -73,9 +74,12 @@ import org.eclipse.jgit.revwalk.RevWalk;* <p>* <b>Message filters:</b>* <ul>- * <li>Author name/email: {@link AuthorRevFilter}</li>- * <li>Committer name/email: {@link CommitterRevFilter}</li>- * <li>Message body: {@link MessageRevFilter}</li>+ * <li>Author name/email:+ * {@link org.eclipse.jgit.revwalk.filter.AuthorRevFilter}</li>+ * <li>Committer name/email:+ * {@link org.eclipse.jgit.revwalk.filter.CommitterRevFilter}</li>+ * <li>Message body:+ * {@link org.eclipse.jgit.revwalk.filter.MessageRevFilter}</li>* </ul>** <p>@@ -88,9 +92,9 @@ import org.eclipse.jgit.revwalk.RevWalk;* <p>* <b>Boolean modifiers:</b>* <ul>- * <li>AND: {@link AndRevFilter}</li>- * <li>OR: {@link OrRevFilter}</li>- * <li>NOT: {@link NotRevFilter}</li>+ * <li>AND: {@link org.eclipse.jgit.revwalk.filter.AndRevFilter}</li>+ * <li>OR: {@link org.eclipse.jgit.revwalk.filter.OrRevFilter}</li>+ * <li>NOT: {@link org.eclipse.jgit.revwalk.filter.NotRevFilter}</li>* </ul>*/public abstract class RevFilter {@@ -99,7 +103,7 @@ public abstract class RevFilter {private static final class AllFilter extends RevFilter {@Override- public boolean include(final RevWalk walker, final RevCommit c) {+ public boolean include(RevWalk walker, RevCommit c) {return true;}@@ -124,7 +128,7 @@ public abstract class RevFilter {private static final class NoneFilter extends RevFilter {@Override- public boolean include(final RevWalk walker, final RevCommit c) {+ public boolean include(RevWalk walker, RevCommit c) {return false;}@@ -180,7 +184,7 @@ public abstract class RevFilter {private static final class NoMergesFilter extends RevFilter {@Override- public boolean include(final RevWalk walker, final RevCommit c) {+ public boolean include(RevWalk walker, RevCommit c) {return c.getParentCount() < 2;}@@ -212,7 +216,7 @@ public abstract class RevFilter {private static final class MergeBaseFilter extends RevFilter {@Override- public boolean include(final RevWalk walker, final RevCommit c) {+ public boolean include(RevWalk walker, RevCommit c) {throw new UnsupportedOperationException(JGitText.get().cannotBeCombined);}@@ -241,7 +245,11 @@ public abstract class RevFilter {return NotRevFilter.create(this);}- /** @return true if the filter needs the commit body to be parsed. */+ /**+ * Whether the filter needs the commit body to be parsed.+ *+ * @return true if the filter needs the commit body to be parsed.+ */public boolean requiresCommitBody() {// Assume true to be backward compatible with prior behavior.return true;@@ -258,19 +266,19 @@ public abstract class RevFilter {* returns true from {@link #requiresCommitBody()}.* @return true to include this commit in the results; false to have this* commit be omitted entirely from the results.- * @throws StopWalkException+ * @throws org.eclipse.jgit.errors.StopWalkException* the filter knows for certain that no additional commits can* ever match, and the current commit doesn't match either. The* walk is halted and no more results are provided.- * @throws MissingObjectException+ * @throws org.eclipse.jgit.errors.MissingObjectException* an object the filter needs to consult to determine its answer* does not exist in the Git repository the walker is operating* on. Filtering this commit is impossible without the object.- * @throws IncorrectObjectTypeException+ * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException* an object the filter needed to consult was not of the* expected object type. This usually indicates a corrupt* repository, as an object link is referencing the wrong type.- * @throws IOException+ * @throws java.io.IOException* a loose object or pack file could not be read to obtain data* necessary for the filter to make its decision.*/@@ -279,16 +287,17 @@ public abstract class RevFilter {IncorrectObjectTypeException, IOException;/**+ * {@inheritDoc}+ * <p>* Clone this revision filter, including its parameters.* <p>* This is a deep clone. If this filter embeds objects or other filters it* must also clone those, to ensure the instances do not share mutable data.- *- * @return another copy of this filter, suitable for another thread.*/@Overridepublic abstract RevFilter clone();+ /** {@inheritDoc} */@Overridepublic String toString() {String n = getClass().getName();diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/RevFlagFilter.javaindex 1fbf74617e..c67c44b216 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java@@ -52,7 +52,9 @@ import org.eclipse.jgit.revwalk.RevFlag;import org.eclipse.jgit.revwalk.RevFlagSet;import org.eclipse.jgit.revwalk.RevWalk;-/** Matches only commits with some/all RevFlags already set. */+/**+ * Matches only commits with some/all RevFlags already set.+ */public abstract class RevFlagFilter extends RevFilter {/*** Create a new filter that tests for a single flag.@@ -61,7 +63,7 @@ public abstract class RevFlagFilter extends RevFilter {* the flag to test.* @return filter that selects only commits with flag <code>a</code>.*/- public static RevFilter has(final RevFlag a) {+ public static RevFilter has(RevFlag a) {final RevFlagSet s = new RevFlagSet();s.add(a);return new HasAll(s);@@ -74,9 +76,9 @@ public abstract class RevFlagFilter extends RevFilter {* set of flags to test.* @return filter that selects only commits with all flags in <code>a</code>.*/- public static RevFilter hasAll(final RevFlag... a) {+ public static RevFilter hasAll(RevFlag... a) {final RevFlagSet set = new RevFlagSet();- for (final RevFlag flag : a)+ for (RevFlag flag : a)set.add(flag);return new HasAll(set);}@@ -88,7 +90,7 @@ public abstract class RevFlagFilter extends RevFilter {* set of flags to test.* @return filter that selects only commits with all flags in <code>a</code>.*/- public static RevFilter hasAll(final RevFlagSet a) {+ public static RevFilter hasAll(RevFlagSet a) {return new HasAll(new RevFlagSet(a));}@@ -99,9 +101,9 @@ public abstract class RevFlagFilter extends RevFilter {* set of flags to test.* @return filter that selects only commits with any flag in <code>a</code>.*/- public static RevFilter hasAny(final RevFlag... a) {+ public static RevFilter hasAny(RevFlag... a) {final RevFlagSet set = new RevFlagSet();- for (final RevFlag flag : a)+ for (RevFlag flag : a)set.add(flag);return new HasAny(set);}@@ -113,33 +115,35 @@ public abstract class RevFlagFilter extends RevFilter {* set of flags to test.* @return filter that selects only commits with any flag in <code>a</code>.*/- public static RevFilter hasAny(final RevFlagSet a) {+ public static RevFilter hasAny(RevFlagSet a) {return new HasAny(new RevFlagSet(a));}final RevFlagSet flags;- RevFlagFilter(final RevFlagSet m) {+ RevFlagFilter(RevFlagSet m) {flags = m;}+ /** {@inheritDoc} */@Overridepublic RevFilter clone() {return this;}+ /** {@inheritDoc} */@Overridepublic String toString() {return super.toString() + flags;}private static class HasAll extends RevFlagFilter {- HasAll(final RevFlagSet m) {+ HasAll(RevFlagSet m) {super(m);}@Override- public boolean include(final RevWalk walker, final RevCommit c)+ public boolean include(RevWalk walker, RevCommit c)throws MissingObjectException, IncorrectObjectTypeException,IOException {return c.hasAll(flags);@@ -152,12 +156,12 @@ public abstract class RevFlagFilter extends RevFilter {}private static class HasAny extends RevFlagFilter {- HasAny(final RevFlagSet m) {+ HasAny(RevFlagSet m) {super(m);}@Override- public boolean include(final RevWalk walker, final RevCommit c)+ public boolean include(RevWalk walker, RevCommit c)throws MissingObjectException, IncorrectObjectTypeException,IOException {return c.hasAny(flags);diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/SkipRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/SkipRevFilter.javaindex e230c9b6b1..79af5a3d4b 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/SkipRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/SkipRevFilter.java@@ -78,6 +78,7 @@ public class SkipRevFilter extends RevFilter {this.skip = skip;}+ /** {@inheritDoc} */@Overridepublic boolean include(RevWalk walker, RevCommit cmit)throws StopWalkException, MissingObjectException,@@ -87,8 +88,9 @@ public class SkipRevFilter extends RevFilter {return true;}+ /** {@inheritDoc} */@Overridepublic RevFilter clone() {return new SkipRevFilter(skip);}-}\ No newline at end of file+}diff --git a/core/src/main/java/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java b/core/src/main/java/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.javaindex ce3a022293..54650da0e0 100644--- a/core/src/main/java/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java+++ b/core/src/main/java/org/eclipse/jgit/revwalk/filter/SubStringRevFilter.java@@ -52,7 +52,9 @@ import org.eclipse.jgit.revwalk.RevWalk;import org.eclipse.jgit.util.RawCharSequence;import org.eclipse.jgit.util.RawSubStringPattern;-/** Abstract filter that searches text using only substring search. */+/**+ * Abstract filter that searches text using only substring search.+ */public abstract class SubStringRevFilter extends RevFilter {/*** Can this string be safely handled by a substring filter?@@ -60,9 +62,10 @@ public abstract class SubStringRevFilter extends RevFilter {* @param pattern* the pattern text proposed by the user.* @return true if a substring filter can perform this pattern match; false- * if {@link PatternMatchRevFilter} must be used instead.+ * if {@link org.eclipse.jgit.revwalk.filter.PatternMatchRevFilter}+ * must be used instead.*/- public static boolean safe(final String pattern) {+ public static boolean safe(String pattern) {for (int i = 0; i < pattern.length(); i++) {final char c = pattern.charAt(i);switch (c) {@@ -93,17 +96,19 @@ public abstract class SubStringRevFilter extends RevFilter {* the {@link #safe(String)} as regular expression meta* characters are treated as literals.*/- protected SubStringRevFilter(final String patternText) {+ protected SubStringRevFilter(String patternText) {pattern = new RawSubStringPattern(patternText);}+ /** {@inheritDoc} */@Override- public boolean include(final RevWalk walker, final RevCommit cmit)+ public boolean include(RevWalk walker, RevCommit cmit)throws MissingObjectException, IncorrectObjectTypeException,IOException {return pattern.match(text(cmit)) >= 0;}+ /** {@inheritDoc} */@Overridepublic boolean requiresCommitBody() {return true;@@ -118,11 +123,13 @@ public abstract class SubStringRevFilter extends RevFilter {*/protected abstract RawCharSequence text(RevCommit cmit);+ /** {@inheritDoc} */@Overridepublic RevFilter clone() {return this; // Typically we are actually thread-safe.}+ /** {@inheritDoc} */@SuppressWarnings("nls")@Overridepublic String toString() {diff --git a/pom.xml b/pom.xmlindex b7e227a1ee..680ae34f9a 100644--- a/pom.xml+++ b/pom.xml@@ -54,164 +54,6 @@<module>core</module><module>product</module></modules>- <dependencyManagement>- <dependencies>- <dependency>- <groupId>commons-codec</groupId>- <artifactId>commons-codec</artifactId>- <version>1.7</version>- </dependency>- <dependency>- <groupId>org.jetbrains.xodus</groupId>- <artifactId>xodus-entity-store</artifactId>- <version>1.0.5</version>- </dependency>- <dependency>- <groupId>org.apache.tika</groupId>- <artifactId>tika-core</artifactId>- <version>1.5</version>- </dependency>- <dependency>- <groupId>org.apache.commons</groupId>- <artifactId>commons-email</artifactId>- <version>1.4</version>- </dependency>- <dependency>- <groupId>org.jsoup</groupId>- <artifactId>jsoup</artifactId>- <version>1.8.1</version>- </dependency>- <dependency>- <groupId>org.apache.velocity</groupId>- <artifactId>velocity</artifactId>- <version>1.7</version>- </dependency>- <dependency>- <groupId>commons-httpclient</groupId>- <artifactId>commons-httpclient</artifactId>- <version>3.1</version>- </dependency>- <dependency>- <groupId>joda-time</groupId>- <artifactId>joda-time</artifactId>- <version>2.2</version>- </dependency>- <dependency>- <groupId>org.javassist</groupId>- <artifactId>javassist</artifactId>- <version>3.20.0-GA</version>- </dependency>- <dependency>- <groupId>org.apache.commons</groupId>- <artifactId>commons-compress</artifactId>- <version>1.8</version>- </dependency>- <dependency>- <groupId>org.eclipse.jetty</groupId>- <artifactId>jetty-server</artifactId>- <version>${jetty.version}</version>- </dependency>- <dependency>- <groupId>org.eclipse.jetty</groupId>- <artifactId>jetty-servlets</artifactId>- <version>${jetty.version}</version>- </dependency>- <dependency>- <groupId>org.eclipse.jetty</groupId>- <artifactId>jetty-servlet</artifactId>- <version>${jetty.version}</version>- </dependency>- <dependency>- <groupId>org.eclipse.jetty</groupId>- <artifactId>jetty-websocket</artifactId>- <version>${jetty.version}</version>- </dependency>- <dependency>- <groupId>org.eclipse.jetty</groupId>- <artifactId>jetty-util</artifactId>- <version>${jetty.version}</version>- </dependency>- <dependency>- <groupId>org.eclipse.jetty.websocket</groupId>- <artifactId>websocket-server</artifactId>- <version>${jetty.version}</version>- </dependency>- <dependency>- <groupId>javax.servlet</groupId>- <artifactId>javax.servlet-api</artifactId>- <version>${servlet.version}</version>- </dependency>- <dependency>- <groupId>com.fasterxml.jackson.core</groupId>- <artifactId>jackson-core</artifactId>- <version>${jackson.version}</version>- </dependency>- <dependency>- <groupId>com.fasterxml.jackson.core</groupId>- <artifactId>jackson-databind</artifactId>- <version>${jackson.version}</version>- </dependency>- <dependency>- <groupId>com.fasterxml.jackson.datatype</groupId>- <artifactId>jackson-datatype-guava</artifactId>- <version>${jackson.version}</version>- </dependency>- <dependency>- <groupId>com.fasterxml.jackson.datatype</groupId>- <artifactId>jackson-datatype-joda</artifactId>- <version>${jackson.version}</version>- </dependency>- <dependency>- <groupId>com.fasterxml.jackson.jaxrs</groupId>- <artifactId>jackson-jaxrs-json-provider</artifactId>- <version>${jackson.version}</version>- </dependency>- <dependency>- <groupId>org.glassfish.jersey.containers</groupId>- <artifactId>jersey-container-servlet</artifactId>- <version>${jersey.version}</version>- </dependency>- <dependency>- <groupId>org.glassfish.jersey.core</groupId>- <artifactId>jersey-client</artifactId>- <version>${jersey.version}</version>- </dependency>- <dependency>- <groupId>org.glassfish.jersey.ext</groupId>- <artifactId>jersey-bean-validation</artifactId>- <version>${jersey.version}</version>- </dependency>- <dependency>- <groupId>org.hibernate</groupId>- <artifactId>hibernate-validator</artifactId>- <version>5.2.4.Final</version>- </dependency>- <dependency>- <groupId>org.reflections</groupId>- <artifactId>reflections</artifactId>- <version>0.9.9</version>- </dependency>- <dependency>- <groupId>org.unbescape</groupId>- <artifactId>unbescape</artifactId>- <version>1.1.2.RELEASE</version>- </dependency>- </dependencies>- </dependencyManagement>- <dependencies>- <dependency>- <groupId>io.onedev</groupId>- <artifactId>launcher-loader</artifactId>- <version>${launcher.version}</version>- </dependency>- <dependency>- <groupId>io.onedev</groupId>- <artifactId>launcher-loader</artifactId>- <version>${launcher.version}</version>- <type>test-jar</type>- <scope>test</scope>- </dependency>- </dependencies><repositories><repository><id>pmeaseRepo</id>@@ -228,12 +70,4 @@</snapshots></repository></repositories>- <properties>- <launcher.version>1.0.2</launcher.version>- <jersey.version>2.13</jersey.version>- <jetty.version>9.3.24.v20180605</jetty.version>- <jackson.version>2.4.3</jackson.version>- <servlet.version>3.1.0</servlet.version>- <antlr.version>4.5.1-1</antlr.version>- </properties></project>\ No newline at end of file