|
|
|
@ -233,7 +233,9 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
|
|
|
|
|
private List<CachedPack> cachedPacks = new ArrayList<>(2); |
|
|
|
|
|
|
|
|
|
private Set<ObjectId> tagTargets = Collections.emptySet(); |
|
|
|
|
private Set<ObjectId> tagTargets = NONE; |
|
|
|
|
|
|
|
|
|
private Set<? extends ObjectId> excludeFromBitmapSelection = NONE; |
|
|
|
|
|
|
|
|
|
private ObjectIdSet[] excludeInPacks; |
|
|
|
|
|
|
|
|
@ -712,8 +714,7 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
public void preparePack(ProgressMonitor countingMonitor, |
|
|
|
|
@NonNull Set<? extends ObjectId> want, |
|
|
|
|
@NonNull Set<? extends ObjectId> have) throws IOException { |
|
|
|
|
preparePack(countingMonitor, |
|
|
|
|
want, have, Collections.<ObjectId> emptySet()); |
|
|
|
|
preparePack(countingMonitor, want, have, NONE, NONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -721,9 +722,9 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
* <p> |
|
|
|
|
* Like {@link #preparePack(ProgressMonitor, Set, Set)} but also allows |
|
|
|
|
* specifying commits that should not be walked past ("shallow" commits). |
|
|
|
|
* The caller is responsible for filtering out commits that should not |
|
|
|
|
* be shallow any more ("unshallow" commits as in {@link #setShallowPack}) |
|
|
|
|
* from the shallow set. |
|
|
|
|
* The caller is responsible for filtering out commits that should not be |
|
|
|
|
* shallow any more ("unshallow" commits as in {@link #setShallowPack}) from |
|
|
|
|
* the shallow set. |
|
|
|
|
* |
|
|
|
|
* @param countingMonitor |
|
|
|
|
* progress during object enumeration. |
|
|
|
@ -731,27 +732,67 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
* objects of interest, ancestors of which will be included in |
|
|
|
|
* the pack. Must not be {@code null}. |
|
|
|
|
* @param have |
|
|
|
|
* objects whose ancestors (up to and including |
|
|
|
|
* {@code shallow} commits) do not need to be included in the |
|
|
|
|
* pack because they are already available from elsewhere. |
|
|
|
|
* Must not be {@code null}. |
|
|
|
|
* objects whose ancestors (up to and including {@code shallow} |
|
|
|
|
* commits) do not need to be included in the pack because they |
|
|
|
|
* are already available from elsewhere. Must not be |
|
|
|
|
* {@code null}. |
|
|
|
|
* @param shallow |
|
|
|
|
* commits indicating the boundary of the history marked with |
|
|
|
|
* {@code have}. Shallow commits have parents but those |
|
|
|
|
* parents are considered not to be already available. |
|
|
|
|
* Parents of {@code shallow} commits and earlier generations |
|
|
|
|
* will be included in the pack if requested by {@code want}. |
|
|
|
|
* Must not be {@code null}. |
|
|
|
|
* {@code have}. Shallow commits have parents but those parents |
|
|
|
|
* are considered not to be already available. Parents of |
|
|
|
|
* {@code shallow} commits and earlier generations will be |
|
|
|
|
* included in the pack if requested by {@code want}. Must not be |
|
|
|
|
* {@code null}. |
|
|
|
|
* @throws IOException |
|
|
|
|
* an I/O problem occured while reading objects. |
|
|
|
|
* an I/O problem occurred while reading objects. |
|
|
|
|
*/ |
|
|
|
|
public void preparePack(ProgressMonitor countingMonitor, |
|
|
|
|
@NonNull Set<? extends ObjectId> want, |
|
|
|
|
@NonNull Set<? extends ObjectId> have, |
|
|
|
|
@NonNull Set<? extends ObjectId> shallow) throws IOException { |
|
|
|
|
preparePack(countingMonitor, want, have, shallow, NONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Prepare the list of objects to be written to the pack stream. |
|
|
|
|
* <p> |
|
|
|
|
* Like {@link #preparePack(ProgressMonitor, Set, Set)} but also allows |
|
|
|
|
* specifying commits that should not be walked past ("shallow" commits). |
|
|
|
|
* The caller is responsible for filtering out commits that should not be |
|
|
|
|
* shallow any more ("unshallow" commits as in {@link #setShallowPack}) from |
|
|
|
|
* the shallow set. |
|
|
|
|
* |
|
|
|
|
* @param countingMonitor |
|
|
|
|
* progress during object enumeration. |
|
|
|
|
* @param want |
|
|
|
|
* objects of interest, ancestors of which will be included in |
|
|
|
|
* the pack. Must not be {@code null}. |
|
|
|
|
* @param have |
|
|
|
|
* objects whose ancestors (up to and including {@code shallow} |
|
|
|
|
* commits) do not need to be included in the pack because they |
|
|
|
|
* are already available from elsewhere. Must not be |
|
|
|
|
* {@code null}. |
|
|
|
|
* @param shallow |
|
|
|
|
* commits indicating the boundary of the history marked with |
|
|
|
|
* {@code have}. Shallow commits have parents but those parents |
|
|
|
|
* are considered not to be already available. Parents of |
|
|
|
|
* {@code shallow} commits and earlier generations will be |
|
|
|
|
* included in the pack if requested by {@code want}. Must not be |
|
|
|
|
* {@code null}. |
|
|
|
|
* @param noBitmaps |
|
|
|
|
* collection of objects to be excluded from bitmap commit |
|
|
|
|
* selection. |
|
|
|
|
* @throws IOException |
|
|
|
|
* an I/O problem occurred while reading objects. |
|
|
|
|
*/ |
|
|
|
|
public void preparePack(ProgressMonitor countingMonitor, |
|
|
|
|
@NonNull Set<? extends ObjectId> want, |
|
|
|
|
@NonNull Set<? extends ObjectId> have, |
|
|
|
|
@NonNull Set<? extends ObjectId> shallow, |
|
|
|
|
@NonNull Set<? extends ObjectId> noBitmaps) throws IOException { |
|
|
|
|
try (ObjectWalk ow = getObjectWalk()) { |
|
|
|
|
ow.assumeShallow(shallow); |
|
|
|
|
preparePack(countingMonitor, ow, want, have); |
|
|
|
|
preparePack(countingMonitor, ow, want, have, noBitmaps); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -784,13 +825,17 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
* points of graph traversal). Pass {@link #NONE} if all objects |
|
|
|
|
* reachable from {@code want} are desired, such as when serving |
|
|
|
|
* a clone. |
|
|
|
|
* @param noBitmaps |
|
|
|
|
* collection of objects to be excluded from bitmap commit |
|
|
|
|
* selection. |
|
|
|
|
* @throws IOException |
|
|
|
|
* when some I/O problem occur during reading objects. |
|
|
|
|
*/ |
|
|
|
|
public void preparePack(ProgressMonitor countingMonitor, |
|
|
|
|
@NonNull ObjectWalk walk, |
|
|
|
|
@NonNull Set<? extends ObjectId> interestingObjects, |
|
|
|
|
@NonNull Set<? extends ObjectId> uninterestingObjects) |
|
|
|
|
@NonNull Set<? extends ObjectId> uninterestingObjects, |
|
|
|
|
@NonNull Set<? extends ObjectId> noBitmaps) |
|
|
|
|
throws IOException { |
|
|
|
|
if (countingMonitor == null) |
|
|
|
|
countingMonitor = NullProgressMonitor.INSTANCE; |
|
|
|
@ -798,7 +843,7 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
throw new IllegalArgumentException( |
|
|
|
|
JGitText.get().shallowPacksRequireDepthWalk); |
|
|
|
|
findObjectsToPack(countingMonitor, walk, interestingObjects, |
|
|
|
|
uninterestingObjects); |
|
|
|
|
uninterestingObjects, noBitmaps); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -965,8 +1010,9 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
/** |
|
|
|
|
* Write the prepared pack to the supplied stream. |
|
|
|
|
* <p> |
|
|
|
|
* Called after {@link #preparePack(ProgressMonitor, ObjectWalk, Set, Set)} |
|
|
|
|
* or {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
|
* Called after |
|
|
|
|
* {@link #preparePack(ProgressMonitor, ObjectWalk, Set, Set, Set)} or |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
|
* <p> |
|
|
|
|
* Performs delta search if enabled and writes the pack stream. |
|
|
|
|
* <p> |
|
|
|
@ -1652,12 +1698,14 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
|
|
|
|
|
private void findObjectsToPack(@NonNull ProgressMonitor countingMonitor, |
|
|
|
|
@NonNull ObjectWalk walker, @NonNull Set<? extends ObjectId> want, |
|
|
|
|
@NonNull Set<? extends ObjectId> have) throws IOException { |
|
|
|
|
@NonNull Set<? extends ObjectId> have, |
|
|
|
|
@NonNull Set<? extends ObjectId> noBitmaps) throws IOException { |
|
|
|
|
final long countingStart = System.currentTimeMillis(); |
|
|
|
|
beginPhase(PackingPhase.COUNTING, countingMonitor, ProgressMonitor.UNKNOWN); |
|
|
|
|
|
|
|
|
|
stats.interestingObjects = Collections.unmodifiableSet(new HashSet<ObjectId>(want)); |
|
|
|
|
stats.uninterestingObjects = Collections.unmodifiableSet(new HashSet<ObjectId>(have)); |
|
|
|
|
excludeFromBitmapSelection = noBitmaps; |
|
|
|
|
|
|
|
|
|
canBuildBitmaps = config.isBuildBitmaps() |
|
|
|
|
&& !shallowPack |
|
|
|
@ -2070,8 +2118,8 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
PackWriterBitmapPreparer bitmapPreparer = new PackWriterBitmapPreparer( |
|
|
|
|
reader, writeBitmaps, pm, stats.interestingObjects, config); |
|
|
|
|
|
|
|
|
|
Collection<PackWriterBitmapPreparer.BitmapCommit> selectedCommits = |
|
|
|
|
bitmapPreparer.selectCommits(numCommits); |
|
|
|
|
Collection<PackWriterBitmapPreparer.BitmapCommit> selectedCommits = bitmapPreparer |
|
|
|
|
.selectCommits(numCommits, excludeFromBitmapSelection); |
|
|
|
|
|
|
|
|
|
beginPhase(PackingPhase.BUILDING_BITMAPS, pm, selectedCommits.size()); |
|
|
|
|
|
|
|
|
|