|
|
|
@ -136,8 +136,8 @@ import org.eclipse.jgit.util.TemporaryBuffer;
|
|
|
|
|
* Typical usage consists of creating instance intended for some pack, |
|
|
|
|
* configuring options, preparing the list of objects by calling |
|
|
|
|
* {@link #preparePack(Iterator)} or |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}, and finally |
|
|
|
|
* producing the stream with |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}, and finally producing the |
|
|
|
|
* stream with |
|
|
|
|
* {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. |
|
|
|
|
* </p> |
|
|
|
|
* <p> |
|
|
|
@ -293,7 +293,7 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
* Create writer for specified repository. |
|
|
|
|
* <p> |
|
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}. |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
|
* |
|
|
|
|
* @param repo |
|
|
|
|
* repository where objects are stored. |
|
|
|
@ -306,7 +306,7 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
* Create a writer to load objects from the specified reader. |
|
|
|
|
* <p> |
|
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}. |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
|
* |
|
|
|
|
* @param reader |
|
|
|
|
* reader to read from the repository with. |
|
|
|
@ -319,7 +319,7 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
* Create writer for specified repository. |
|
|
|
|
* <p> |
|
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}. |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
|
* |
|
|
|
|
* @param repo |
|
|
|
|
* repository where objects are stored. |
|
|
|
@ -334,7 +334,7 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
* Create writer with a specified configuration. |
|
|
|
|
* <p> |
|
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}. |
|
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
|
* |
|
|
|
|
* @param config |
|
|
|
|
* configuration for the pack writer. |
|
|
|
@ -495,7 +495,7 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
/** |
|
|
|
|
* @return true to ignore objects that are uninteresting and also not found |
|
|
|
|
* on local disk; false to throw a {@link MissingObjectException} |
|
|
|
|
* out of {@link #preparePack(ProgressMonitor, Collection, Collection)} if an |
|
|
|
|
* out of {@link #preparePack(ProgressMonitor, Set, Set)} if an |
|
|
|
|
* uninteresting object is not in the source repository. By default, |
|
|
|
|
* true, permitting gracefully ignoring of uninteresting objects. |
|
|
|
|
*/ |
|
|
|
@ -648,86 +648,6 @@ public class PackWriter implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Prepare the list of objects to be written to the pack stream. |
|
|
|
|
* <p> |
|
|
|
|
* Basing on these 2 sets, another set of objects to put in a pack file is |
|
|
|
|
* created: this set consists of all objects reachable (ancestors) from |
|
|
|
|
* interesting objects, except uninteresting objects and their ancestors. |
|
|
|
|
* This method uses class {@link ObjectWalk} extensively to find out that |
|
|
|
|
* appropriate set of output objects and their optimal order in output pack. |
|
|
|
|
* Order is consistent with general git in-pack rules: sort by object type, |
|
|
|
|
* recency, path and delta-base first. |
|
|
|
|
* </p> |
|
|
|
|
* |
|
|
|
|
* @param countingMonitor |
|
|
|
|
* progress during object enumeration. |
|
|
|
|
* @param want |
|
|
|
|
* collection of objects to be marked as interesting (start |
|
|
|
|
* points of graph traversal). |
|
|
|
|
* @param have |
|
|
|
|
* collection of objects to be marked as uninteresting (end |
|
|
|
|
* points of graph traversal). |
|
|
|
|
* @throws IOException |
|
|
|
|
* when some I/O problem occur during reading objects. |
|
|
|
|
* @deprecated to be removed in 2.0; use the Set version of this method. |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public void preparePack(ProgressMonitor countingMonitor, |
|
|
|
|
final Collection<? extends ObjectId> want, |
|
|
|
|
final Collection<? extends ObjectId> have) throws IOException { |
|
|
|
|
preparePack(countingMonitor, ensureSet(want), ensureSet(have)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Prepare the list of objects to be written to the pack stream. |
|
|
|
|
* <p> |
|
|
|
|
* Basing on these 2 sets, another set of objects to put in a pack file is |
|
|
|
|
* created: this set consists of all objects reachable (ancestors) from |
|
|
|
|
* interesting objects, except uninteresting objects and their ancestors. |
|
|
|
|
* This method uses class {@link ObjectWalk} extensively to find out that |
|
|
|
|
* appropriate set of output objects and their optimal order in output pack. |
|
|
|
|
* Order is consistent with general git in-pack rules: sort by object type, |
|
|
|
|
* recency, path and delta-base first. |
|
|
|
|
* </p> |
|
|
|
|
* |
|
|
|
|
* @param countingMonitor |
|
|
|
|
* progress during object enumeration. |
|
|
|
|
* @param walk |
|
|
|
|
* ObjectWalk to perform enumeration. |
|
|
|
|
* @param interestingObjects |
|
|
|
|
* collection of objects to be marked as interesting (start |
|
|
|
|
* points of graph traversal). |
|
|
|
|
* @param uninterestingObjects |
|
|
|
|
* collection of objects to be marked as uninteresting (end |
|
|
|
|
* points of graph traversal). |
|
|
|
|
* @throws IOException |
|
|
|
|
* when some I/O problem occur during reading objects. |
|
|
|
|
* @deprecated to be removed in 2.0; use the Set version of this method. |
|
|
|
|
*/ |
|
|
|
|
@Deprecated |
|
|
|
|
public void preparePack(ProgressMonitor countingMonitor, |
|
|
|
|
ObjectWalk walk, |
|
|
|
|
final Collection<? extends ObjectId> interestingObjects, |
|
|
|
|
final Collection<? extends ObjectId> uninterestingObjects) |
|
|
|
|
throws IOException { |
|
|
|
|
preparePack(countingMonitor, walk, |
|
|
|
|
ensureSet(interestingObjects), |
|
|
|
|
ensureSet(uninterestingObjects)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
private static Set<ObjectId> ensureSet(Collection<? extends ObjectId> objs) { |
|
|
|
|
Set<ObjectId> set; |
|
|
|
|
if (objs instanceof Set<?>) |
|
|
|
|
set = (Set<ObjectId>) objs; |
|
|
|
|
else if (objs == null) |
|
|
|
|
set = Collections.emptySet(); |
|
|
|
|
else |
|
|
|
|
set = new HashSet<ObjectId>(objs); |
|
|
|
|
return set; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Prepare the list of objects to be written to the pack stream. |
|
|
|
|
* <p> |
|
|
|
|