Bundles generated by this class can be later read in from a file URI using
the bundle transport, or from an application controlled buffer by the more
generic org..
Applications creating bundles need to call one or more include
calls to reflect which objects should be available as refs in the bundle for
the other side to fetch. At least one include is required to create a valid
bundle file, and duplicate names are not permitted.
Optional assume calls can be made to declare commits which the
recipient must have in order to fetch from the bundle file. Objects reachable
from these assumed commits can be used as delta bases in order to reduce the
overall bundle size.
| Modifier and Type | Field and Description |
|---|---|
| private final Set | |
| private final List | |
| private ObjectCountCallback | |
| private final Repository | |
| private final Map | |
| private PackConfig | |
| private final ObjectReader | |
| private final Set |
| Access | Constructor and Description |
|---|---|
| public | |
| public | BundleWriter(ObjectReader
reader for reading objects. Will be closed at the end of or)writeBundle(ProgressMonitor, OutputStream), but readers may be
reused after closing.Create a writer for a bundle. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | include(String
name the recipient can discover this object as from the
bundle's list of advertised refs . The name must be a valid
ref format and must not have already been included in this
bundle writer. name, AnyObjectId object to pack. Multiple refs may point to the same object. id)Include an object (and everything reachable from it) in the bundle. |
| public void | |
| private PackWriter | |
| public BundleWriter | Returns: this object for chaining.the callback to set callback) |
| public void | setPackConfig(PackConfig
configuration controlling packing parameters. If null the
source repository's settings will be used, or the default
settings if constructed without a repo. pc)Set the configuration used by the pack generator. |
| public void | writeBundle(ProgressMonitor
progress monitor to report bundle writing status to. monitor, OutputStream the stream the bundle is written to. The stream should be
buffered by the caller. The caller is responsible for closing
the stream. os)Generate and write the bundle to the output stream. |
| assume | back to summary |
|---|---|
| private final Set<RevCommit> assume | |
| cachedPacks | back to summary |
|---|---|
| private final List<CachedPack> cachedPacks | |
| callback | back to summary |
|---|---|
| private ObjectCountCallback callback | |
| db | back to summary |
|---|---|
| private final Repository db | |
| include | back to summary |
|---|---|
| private final Map<String, ObjectId> include | |
| packConfig | back to summary |
|---|---|
| private PackConfig packConfig | |
| reader | back to summary |
|---|---|
| private final ObjectReader reader | |
| tagTargets | back to summary |
|---|---|
| private final Set<ObjectId> tagTargets | |
| BundleWriter | back to summary |
|---|---|
| public BundleWriter(Repository repo) Create a writer for a bundle.
| |
| BundleWriter | back to summary |
|---|---|
| public BundleWriter(ObjectReader or) Create a writer for a bundle.
| |
| addObjectsAsIs | back to summary |
|---|---|
| public void addObjectsAsIs(Collection<? extends CachedPack> c) Add objects to the bundle file. When this method is used, object traversal is disabled and specified pack files are directly saved to the Git bundle file.
Unlike
| |
| assume | back to summary |
|---|---|
| public void assume(RevCommit c) Assume a commit is available on the recipient's side. In order to fetch from a bundle the recipient must have any assumed commit. Each assumed commit is explicitly recorded in the bundle header to permit the recipient to validate it has these objects.
| |
| include | back to summary |
|---|---|
| public void include(String name, AnyObjectId id) Include an object (and everything reachable from it) in the bundle.
| |
| include | back to summary |
|---|---|
| public void include(Ref r) Include a single ref (a name/object pair) in the bundle.
This is a utility function for:
| |
| newPackWriter | back to summary |
|---|---|
| private PackWriter newPackWriter() | |
| setObjectCountCallback | back to summary |
|---|---|
| public BundleWriter setObjectCountCallback(ObjectCountCallback callback) Set the
It should be set before calling
This callback will be passed on to
| |
| setPackConfig | back to summary |
|---|---|
| public void setPackConfig(PackConfig pc) Set the configuration used by the pack generator.
| |
| writeBundle | back to summary |
|---|---|
| public void writeBundle(ProgressMonitor monitor, OutputStream os) throws IOException Generate and write the bundle to the output stream. This method can only be called once per BundleWriter instance.
| |