RefAdvancerWalk: Move to revwalk package

We need this in the non-DFS side.

Move it to a common package like revwalk.

Change-Id: I829d94dadc61aa01be2fce46dfe08b7b6a6a6964
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/RefAdvancerWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/RefAdvancerWalkTest.java
index 321ea01..728feea 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/RefAdvancerWalkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/RefAdvancerWalkTest.java
@@ -19,6 +19,7 @@
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import org.eclipse.jgit.internal.revwalk.RefAdvancerWalk;
 import org.eclipse.jgit.junit.TestRepository;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.revwalk.RevCommit;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/RefAdvancerWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/revwalk/RefAdvancerWalk.java
similarity index 77%
rename from org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/RefAdvancerWalk.java
rename to org.eclipse.jgit/src/org/eclipse/jgit/internal/revwalk/RefAdvancerWalk.java
index d0d8056..714ccf7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/RefAdvancerWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/revwalk/RefAdvancerWalk.java
@@ -7,7 +7,7 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
-package org.eclipse.jgit.internal.storage.dfs;
+package org.eclipse.jgit.internal.revwalk;
 
 import java.io.IOException;
 import java.util.HashSet;
@@ -16,6 +16,7 @@
 
 import org.eclipse.jgit.errors.StopWalkException;
 import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevObject;
 import org.eclipse.jgit.revwalk.RevSort;
@@ -25,21 +26,38 @@
 /**
  * Walk from some commits and find where to they enter a pack
  */
-class RefAdvancerWalk {
+public class RefAdvancerWalk {
 
-	private final DfsRepository db;
+	private final Repository db;
 
 	private final InPackPredicate includeP;
 
 	/**
-	 * True when the commit is in the pack
+	 * True when the commit is in the target set
 	 */
 	@FunctionalInterface
-	interface InPackPredicate {
+	public interface InPackPredicate {
+		/**
+		 * Check if the commit belongs to the "pack" (target set of objects)
+		 * 
+		 * @param c
+		 *            a commit
+		 * @return true if the commit is in the set
+		 * @throws IOException
+		 *             an error reading data
+		 */
 		boolean test(RevCommit c) throws IOException;
 	}
 
-	RefAdvancerWalk(DfsRepository db, InPackPredicate include) {
+	/**
+	 * Constructor
+	 *
+	 * @param db
+	 *            a repository
+	 * @param include
+	 *            predicate telling if a commit in the target set
+	 */
+	public RefAdvancerWalk(Repository db, InPackPredicate include) {
 		this.db = db;
 		this.includeP = include;
 	}
@@ -64,7 +82,7 @@ private RevWalk createRevWalk() {
 	 * @throws IOException
 	 *             error browsing history
 	 */
-	Set<RevCommit> advance(List<ObjectId> allTips) throws IOException {
+	public Set<RevCommit> advance(List<ObjectId> allTips) throws IOException {
 		Set<RevCommit> tipsInMidx = new HashSet<>(allTips.size());
 		try (RevWalk rw = createRevWalk()) {
 			for (ObjectId tip : allTips) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsMidxWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsMidxWriter.java
index 9691d1b..5c50ca4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsMidxWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsMidxWriter.java
@@ -24,6 +24,7 @@
 import java.util.function.Function;
 
 import org.eclipse.jgit.annotations.Nullable;
+import org.eclipse.jgit.internal.revwalk.RefAdvancerWalk;
 import org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder;
 import org.eclipse.jgit.internal.storage.midx.MultiPackIndexWriter;
 import org.eclipse.jgit.internal.storage.midx.PackIndexMerger;