|
|
@ -136,8 +136,8 @@ import org.eclipse.jgit.util.TemporaryBuffer; |
|
|
|
* Typical usage consists of creating instance intended for some pack, |
|
|
|
* Typical usage consists of creating instance intended for some pack, |
|
|
|
* configuring options, preparing the list of objects by calling |
|
|
|
* configuring options, preparing the list of objects by calling |
|
|
|
* {@link #preparePack(Iterator)} or |
|
|
|
* {@link #preparePack(Iterator)} or |
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}, and finally |
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}, and finally producing the |
|
|
|
* producing the stream with |
|
|
|
* stream with |
|
|
|
* {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. |
|
|
|
* {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. |
|
|
|
* </p> |
|
|
|
* </p> |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -293,7 +293,7 @@ public class PackWriter implements AutoCloseable { |
|
|
|
* Create writer for specified repository. |
|
|
|
* Create writer for specified repository. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}. |
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param repo |
|
|
|
* @param repo |
|
|
|
* repository where objects are stored. |
|
|
|
* repository where objects are stored. |
|
|
@ -306,7 +306,7 @@ public class PackWriter implements AutoCloseable { |
|
|
|
* Create a writer to load objects from the specified reader. |
|
|
|
* Create a writer to load objects from the specified reader. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}. |
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param reader |
|
|
|
* @param reader |
|
|
|
* reader to read from the repository with. |
|
|
|
* reader to read from the repository with. |
|
|
@ -319,7 +319,7 @@ public class PackWriter implements AutoCloseable { |
|
|
|
* Create writer for specified repository. |
|
|
|
* Create writer for specified repository. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}. |
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param repo |
|
|
|
* @param repo |
|
|
|
* repository where objects are stored. |
|
|
|
* repository where objects are stored. |
|
|
@ -334,7 +334,7 @@ public class PackWriter implements AutoCloseable { |
|
|
|
* Create writer with a specified configuration. |
|
|
|
* Create writer with a specified configuration. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
* Objects for packing are specified in {@link #preparePack(Iterator)} or |
|
|
|
* {@link #preparePack(ProgressMonitor, Collection, Collection)}. |
|
|
|
* {@link #preparePack(ProgressMonitor, Set, Set)}. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param config |
|
|
|
* @param config |
|
|
|
* configuration for the pack writer. |
|
|
|
* 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 |
|
|
|
* @return true to ignore objects that are uninteresting and also not found |
|
|
|
* on local disk; false to throw a {@link MissingObjectException} |
|
|
|
* 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, |
|
|
|
* uninteresting object is not in the source repository. By default, |
|
|
|
* true, permitting gracefully ignoring of uninteresting objects. |
|
|
|
* 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. |
|
|
|
* Prepare the list of objects to be written to the pack stream. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|