Support creating pack bitmap indexes in PackWriter.
Update the PackWriter to support writing out pack bitmap indexes,
a parallel ".bitmap" file to the ".pack" file.
Bitmaps are selected at commits every 1 to 5,000 commits for
each unique path from the start. The most recent 100 commits are
all bitmapped. The next 19,000 commits have a bitmaps every 100
commits. The remaining commits have a bitmap every 5,000 commits.
Commits with more than 1 parent are prefered over ones
with 1 or less. Furthermore, previously computed bitmaps are reused,
if the previous entry had the reuse flag set, which is set when the
bitmap was placed at the max allowed distance.
Bitmaps are used to speed up the counting phase when packing, for
requests that are not shallow. The PackWriterBitmapWalker uses
a RevFilter to proactively mark commits with RevFlag.SEEN, when
they appear in a bitmap. The walker produces the full closure
of reachable ObjectIds, given the collection of starting ObjectIds.
For fetch request, two ObjectWalks are executed to compute the
ObjectIds reachable from the haves and from the wants. The
ObjectIds needed to be written are determined by taking all the
resulting wants AND NOT the haves.
For clone requests, we get cached pack support for "free" since
it is possible to determine if all of the ObjectIds in a pack file
are included in the resulting list of ObjectIds to write.
On my machine, the best times for clones and fetches of the linux
kernel repository (with about 2.6M objects and 300K commits) are
tabulated below:
Operation Index V2 Index VE003
Clone 37530ms (524.06 MiB) 82ms (524.06 MiB)
Fetch (1 commit back) 75ms 107ms
Fetch (10 commits back) 456ms (269.51 KiB) 341ms (265.19 KiB)
Fetch (100 commits back) 449ms (269.91 KiB) 337ms (267.28 KiB)
Fetch (1000 commits back) 2229ms ( 14.75 MiB) 189ms ( 14.42 MiB)
Fetch (10000 commits back) 2177ms ( 16.30 MiB) 254ms ( 15.88 MiB)
Fetch (100000 commits back) 14340ms (185.83 MiB) 1655ms (189.39 MiB)
Change-Id: Icdb0cdd66ff168917fb9ef17b96093990cc6a98d
12 years ago Support creating pack bitmap indexes in PackWriter.
Update the PackWriter to support writing out pack bitmap indexes,
a parallel ".bitmap" file to the ".pack" file.
Bitmaps are selected at commits every 1 to 5,000 commits for
each unique path from the start. The most recent 100 commits are
all bitmapped. The next 19,000 commits have a bitmaps every 100
commits. The remaining commits have a bitmap every 5,000 commits.
Commits with more than 1 parent are prefered over ones
with 1 or less. Furthermore, previously computed bitmaps are reused,
if the previous entry had the reuse flag set, which is set when the
bitmap was placed at the max allowed distance.
Bitmaps are used to speed up the counting phase when packing, for
requests that are not shallow. The PackWriterBitmapWalker uses
a RevFilter to proactively mark commits with RevFlag.SEEN, when
they appear in a bitmap. The walker produces the full closure
of reachable ObjectIds, given the collection of starting ObjectIds.
For fetch request, two ObjectWalks are executed to compute the
ObjectIds reachable from the haves and from the wants. The
ObjectIds needed to be written are determined by taking all the
resulting wants AND NOT the haves.
For clone requests, we get cached pack support for "free" since
it is possible to determine if all of the ObjectIds in a pack file
are included in the resulting list of ObjectIds to write.
On my machine, the best times for clones and fetches of the linux
kernel repository (with about 2.6M objects and 300K commits) are
tabulated below:
Operation Index V2 Index VE003
Clone 37530ms (524.06 MiB) 82ms (524.06 MiB)
Fetch (1 commit back) 75ms 107ms
Fetch (10 commits back) 456ms (269.51 KiB) 341ms (265.19 KiB)
Fetch (100 commits back) 449ms (269.91 KiB) 337ms (267.28 KiB)
Fetch (1000 commits back) 2229ms ( 14.75 MiB) 189ms ( 14.42 MiB)
Fetch (10000 commits back) 2177ms ( 16.30 MiB) 254ms ( 15.88 MiB)
Fetch (100000 commits back) 14340ms (185.83 MiB) 1655ms (189.39 MiB)
Change-Id: Icdb0cdd66ff168917fb9ef17b96093990cc6a98d
12 years ago Support creating pack bitmap indexes in PackWriter.
Update the PackWriter to support writing out pack bitmap indexes,
a parallel ".bitmap" file to the ".pack" file.
Bitmaps are selected at commits every 1 to 5,000 commits for
each unique path from the start. The most recent 100 commits are
all bitmapped. The next 19,000 commits have a bitmaps every 100
commits. The remaining commits have a bitmap every 5,000 commits.
Commits with more than 1 parent are prefered over ones
with 1 or less. Furthermore, previously computed bitmaps are reused,
if the previous entry had the reuse flag set, which is set when the
bitmap was placed at the max allowed distance.
Bitmaps are used to speed up the counting phase when packing, for
requests that are not shallow. The PackWriterBitmapWalker uses
a RevFilter to proactively mark commits with RevFlag.SEEN, when
they appear in a bitmap. The walker produces the full closure
of reachable ObjectIds, given the collection of starting ObjectIds.
For fetch request, two ObjectWalks are executed to compute the
ObjectIds reachable from the haves and from the wants. The
ObjectIds needed to be written are determined by taking all the
resulting wants AND NOT the haves.
For clone requests, we get cached pack support for "free" since
it is possible to determine if all of the ObjectIds in a pack file
are included in the resulting list of ObjectIds to write.
On my machine, the best times for clones and fetches of the linux
kernel repository (with about 2.6M objects and 300K commits) are
tabulated below:
Operation Index V2 Index VE003
Clone 37530ms (524.06 MiB) 82ms (524.06 MiB)
Fetch (1 commit back) 75ms 107ms
Fetch (10 commits back) 456ms (269.51 KiB) 341ms (265.19 KiB)
Fetch (100 commits back) 449ms (269.91 KiB) 337ms (267.28 KiB)
Fetch (1000 commits back) 2229ms ( 14.75 MiB) 189ms ( 14.42 MiB)
Fetch (10000 commits back) 2177ms ( 16.30 MiB) 254ms ( 15.88 MiB)
Fetch (100000 commits back) 14340ms (185.83 MiB) 1655ms (189.39 MiB)
Change-Id: Icdb0cdd66ff168917fb9ef17b96093990cc6a98d
12 years ago Support creating pack bitmap indexes in PackWriter.
Update the PackWriter to support writing out pack bitmap indexes,
a parallel ".bitmap" file to the ".pack" file.
Bitmaps are selected at commits every 1 to 5,000 commits for
each unique path from the start. The most recent 100 commits are
all bitmapped. The next 19,000 commits have a bitmaps every 100
commits. The remaining commits have a bitmap every 5,000 commits.
Commits with more than 1 parent are prefered over ones
with 1 or less. Furthermore, previously computed bitmaps are reused,
if the previous entry had the reuse flag set, which is set when the
bitmap was placed at the max allowed distance.
Bitmaps are used to speed up the counting phase when packing, for
requests that are not shallow. The PackWriterBitmapWalker uses
a RevFilter to proactively mark commits with RevFlag.SEEN, when
they appear in a bitmap. The walker produces the full closure
of reachable ObjectIds, given the collection of starting ObjectIds.
For fetch request, two ObjectWalks are executed to compute the
ObjectIds reachable from the haves and from the wants. The
ObjectIds needed to be written are determined by taking all the
resulting wants AND NOT the haves.
For clone requests, we get cached pack support for "free" since
it is possible to determine if all of the ObjectIds in a pack file
are included in the resulting list of ObjectIds to write.
On my machine, the best times for clones and fetches of the linux
kernel repository (with about 2.6M objects and 300K commits) are
tabulated below:
Operation Index V2 Index VE003
Clone 37530ms (524.06 MiB) 82ms (524.06 MiB)
Fetch (1 commit back) 75ms 107ms
Fetch (10 commits back) 456ms (269.51 KiB) 341ms (265.19 KiB)
Fetch (100 commits back) 449ms (269.91 KiB) 337ms (267.28 KiB)
Fetch (1000 commits back) 2229ms ( 14.75 MiB) 189ms ( 14.42 MiB)
Fetch (10000 commits back) 2177ms ( 16.30 MiB) 254ms ( 15.88 MiB)
Fetch (100000 commits back) 14340ms (185.83 MiB) 1655ms (189.39 MiB)
Change-Id: Icdb0cdd66ff168917fb9ef17b96093990cc6a98d
12 years ago Support creating pack bitmap indexes in PackWriter.
Update the PackWriter to support writing out pack bitmap indexes,
a parallel ".bitmap" file to the ".pack" file.
Bitmaps are selected at commits every 1 to 5,000 commits for
each unique path from the start. The most recent 100 commits are
all bitmapped. The next 19,000 commits have a bitmaps every 100
commits. The remaining commits have a bitmap every 5,000 commits.
Commits with more than 1 parent are prefered over ones
with 1 or less. Furthermore, previously computed bitmaps are reused,
if the previous entry had the reuse flag set, which is set when the
bitmap was placed at the max allowed distance.
Bitmaps are used to speed up the counting phase when packing, for
requests that are not shallow. The PackWriterBitmapWalker uses
a RevFilter to proactively mark commits with RevFlag.SEEN, when
they appear in a bitmap. The walker produces the full closure
of reachable ObjectIds, given the collection of starting ObjectIds.
For fetch request, two ObjectWalks are executed to compute the
ObjectIds reachable from the haves and from the wants. The
ObjectIds needed to be written are determined by taking all the
resulting wants AND NOT the haves.
For clone requests, we get cached pack support for "free" since
it is possible to determine if all of the ObjectIds in a pack file
are included in the resulting list of ObjectIds to write.
On my machine, the best times for clones and fetches of the linux
kernel repository (with about 2.6M objects and 300K commits) are
tabulated below:
Operation Index V2 Index VE003
Clone 37530ms (524.06 MiB) 82ms (524.06 MiB)
Fetch (1 commit back) 75ms 107ms
Fetch (10 commits back) 456ms (269.51 KiB) 341ms (265.19 KiB)
Fetch (100 commits back) 449ms (269.91 KiB) 337ms (267.28 KiB)
Fetch (1000 commits back) 2229ms ( 14.75 MiB) 189ms ( 14.42 MiB)
Fetch (10000 commits back) 2177ms ( 16.30 MiB) 254ms ( 15.88 MiB)
Fetch (100000 commits back) 14340ms (185.83 MiB) 1655ms (189.39 MiB)
Change-Id: Icdb0cdd66ff168917fb9ef17b96093990cc6a98d
12 years ago Support creating pack bitmap indexes in PackWriter.
Update the PackWriter to support writing out pack bitmap indexes,
a parallel ".bitmap" file to the ".pack" file.
Bitmaps are selected at commits every 1 to 5,000 commits for
each unique path from the start. The most recent 100 commits are
all bitmapped. The next 19,000 commits have a bitmaps every 100
commits. The remaining commits have a bitmap every 5,000 commits.
Commits with more than 1 parent are prefered over ones
with 1 or less. Furthermore, previously computed bitmaps are reused,
if the previous entry had the reuse flag set, which is set when the
bitmap was placed at the max allowed distance.
Bitmaps are used to speed up the counting phase when packing, for
requests that are not shallow. The PackWriterBitmapWalker uses
a RevFilter to proactively mark commits with RevFlag.SEEN, when
they appear in a bitmap. The walker produces the full closure
of reachable ObjectIds, given the collection of starting ObjectIds.
For fetch request, two ObjectWalks are executed to compute the
ObjectIds reachable from the haves and from the wants. The
ObjectIds needed to be written are determined by taking all the
resulting wants AND NOT the haves.
For clone requests, we get cached pack support for "free" since
it is possible to determine if all of the ObjectIds in a pack file
are included in the resulting list of ObjectIds to write.
On my machine, the best times for clones and fetches of the linux
kernel repository (with about 2.6M objects and 300K commits) are
tabulated below:
Operation Index V2 Index VE003
Clone 37530ms (524.06 MiB) 82ms (524.06 MiB)
Fetch (1 commit back) 75ms 107ms
Fetch (10 commits back) 456ms (269.51 KiB) 341ms (265.19 KiB)
Fetch (100 commits back) 449ms (269.91 KiB) 337ms (267.28 KiB)
Fetch (1000 commits back) 2229ms ( 14.75 MiB) 189ms ( 14.42 MiB)
Fetch (10000 commits back) 2177ms ( 16.30 MiB) 254ms ( 15.88 MiB)
Fetch (100000 commits back) 14340ms (185.83 MiB) 1655ms (189.39 MiB)
Change-Id: Icdb0cdd66ff168917fb9ef17b96093990cc6a98d
12 years ago Support creating pack bitmap indexes in PackWriter.
Update the PackWriter to support writing out pack bitmap indexes,
a parallel ".bitmap" file to the ".pack" file.
Bitmaps are selected at commits every 1 to 5,000 commits for
each unique path from the start. The most recent 100 commits are
all bitmapped. The next 19,000 commits have a bitmaps every 100
commits. The remaining commits have a bitmap every 5,000 commits.
Commits with more than 1 parent are prefered over ones
with 1 or less. Furthermore, previously computed bitmaps are reused,
if the previous entry had the reuse flag set, which is set when the
bitmap was placed at the max allowed distance.
Bitmaps are used to speed up the counting phase when packing, for
requests that are not shallow. The PackWriterBitmapWalker uses
a RevFilter to proactively mark commits with RevFlag.SEEN, when
they appear in a bitmap. The walker produces the full closure
of reachable ObjectIds, given the collection of starting ObjectIds.
For fetch request, two ObjectWalks are executed to compute the
ObjectIds reachable from the haves and from the wants. The
ObjectIds needed to be written are determined by taking all the
resulting wants AND NOT the haves.
For clone requests, we get cached pack support for "free" since
it is possible to determine if all of the ObjectIds in a pack file
are included in the resulting list of ObjectIds to write.
On my machine, the best times for clones and fetches of the linux
kernel repository (with about 2.6M objects and 300K commits) are
tabulated below:
Operation Index V2 Index VE003
Clone 37530ms (524.06 MiB) 82ms (524.06 MiB)
Fetch (1 commit back) 75ms 107ms
Fetch (10 commits back) 456ms (269.51 KiB) 341ms (265.19 KiB)
Fetch (100 commits back) 449ms (269.91 KiB) 337ms (267.28 KiB)
Fetch (1000 commits back) 2229ms ( 14.75 MiB) 189ms ( 14.42 MiB)
Fetch (10000 commits back) 2177ms ( 16.30 MiB) 254ms ( 15.88 MiB)
Fetch (100000 commits back) 14340ms (185.83 MiB) 1655ms (189.39 MiB)
Change-Id: Icdb0cdd66ff168917fb9ef17b96093990cc6a98d
12 years ago Support creating pack bitmap indexes in PackWriter.
Update the PackWriter to support writing out pack bitmap indexes,
a parallel ".bitmap" file to the ".pack" file.
Bitmaps are selected at commits every 1 to 5,000 commits for
each unique path from the start. The most recent 100 commits are
all bitmapped. The next 19,000 commits have a bitmaps every 100
commits. The remaining commits have a bitmap every 5,000 commits.
Commits with more than 1 parent are prefered over ones
with 1 or less. Furthermore, previously computed bitmaps are reused,
if the previous entry had the reuse flag set, which is set when the
bitmap was placed at the max allowed distance.
Bitmaps are used to speed up the counting phase when packing, for
requests that are not shallow. The PackWriterBitmapWalker uses
a RevFilter to proactively mark commits with RevFlag.SEEN, when
they appear in a bitmap. The walker produces the full closure
of reachable ObjectIds, given the collection of starting ObjectIds.
For fetch request, two ObjectWalks are executed to compute the
ObjectIds reachable from the haves and from the wants. The
ObjectIds needed to be written are determined by taking all the
resulting wants AND NOT the haves.
For clone requests, we get cached pack support for "free" since
it is possible to determine if all of the ObjectIds in a pack file
are included in the resulting list of ObjectIds to write.
On my machine, the best times for clones and fetches of the linux
kernel repository (with about 2.6M objects and 300K commits) are
tabulated below:
Operation Index V2 Index VE003
Clone 37530ms (524.06 MiB) 82ms (524.06 MiB)
Fetch (1 commit back) 75ms 107ms
Fetch (10 commits back) 456ms (269.51 KiB) 341ms (265.19 KiB)
Fetch (100 commits back) 449ms (269.91 KiB) 337ms (267.28 KiB)
Fetch (1000 commits back) 2229ms ( 14.75 MiB) 189ms ( 14.42 MiB)
Fetch (10000 commits back) 2177ms ( 16.30 MiB) 254ms ( 15.88 MiB)
Fetch (100000 commits back) 14340ms (185.83 MiB) 1655ms (189.39 MiB)
Change-Id: Icdb0cdd66ff168917fb9ef17b96093990cc6a98d
12 years ago |
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077 |
- /*
- * Copyright (C) 2008-2010, Google Inc.
- * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
- * and other copyright owners as documented in the project's IP log.
- *
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Distribution License v1.0 which
- * accompanies this distribution, is reproduced below, and is
- * available at http://www.eclipse.org/org/documents/edl-v10.php
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- * - Neither the name of the Eclipse Foundation, Inc. nor the
- * names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
- package org.eclipse.jgit.storage.pack;
-
- import java.util.concurrent.Executor;
- import java.util.zip.Deflater;
-
- import org.eclipse.jgit.internal.storage.file.PackIndexWriter;
- import org.eclipse.jgit.lib.Config;
- import org.eclipse.jgit.lib.Repository;
-
- /**
- * Configuration used by a pack writer when constructing the stream.
- *
- * A configuration may be modified once created, but should not be modified
- * while it is being used by a PackWriter. If a configuration is not modified it
- * is safe to share the same configuration instance between multiple concurrent
- * threads executing different PackWriters.
- */
- public class PackConfig {
- /**
- * Default value of deltas reuse option: {@value}
- *
- * @see #setReuseDeltas(boolean)
- */
- public static final boolean DEFAULT_REUSE_DELTAS = true;
-
- /**
- * Default value of objects reuse option: {@value}
- *
- * @see #setReuseObjects(boolean)
- */
- public static final boolean DEFAULT_REUSE_OBJECTS = true;
-
- /**
- * Default value of keep old packs option: {@value}
- *
- * @see #setPreserveOldPacks(boolean)
- */
- public static final boolean DEFAULT_PRESERVE_OLD_PACKS = false;
-
- /**
- * Default value of prune old packs option: {@value}
- *
- * @see #setPrunePreserved(boolean)
- */
- public static final boolean DEFAULT_PRUNE_PRESERVED = false;
-
- /**
- * Default value of delta compress option: {@value}
- *
- * @see #setDeltaCompress(boolean)
- */
- public static final boolean DEFAULT_DELTA_COMPRESS = true;
-
- /**
- * Default value of delta base as offset option: {@value}
- *
- * @see #setDeltaBaseAsOffset(boolean)
- */
- public static final boolean DEFAULT_DELTA_BASE_AS_OFFSET = false;
-
- /**
- * Default value of maximum delta chain depth: {@value}
- *
- * @see #setMaxDeltaDepth(int)
- */
- public static final int DEFAULT_MAX_DELTA_DEPTH = 50;
-
- /**
- * Default window size during packing: {@value}
- *
- * @see #setDeltaSearchWindowSize(int)
- */
- public static final int DEFAULT_DELTA_SEARCH_WINDOW_SIZE = 10;
-
- /**
- * Default big file threshold: {@value}
- *
- * @see #setBigFileThreshold(int)
- */
- public static final int DEFAULT_BIG_FILE_THRESHOLD = 50 * 1024 * 1024;
-
- /**
- * Default delta cache size: {@value}
- *
- * @see #setDeltaCacheSize(long)
- */
- public static final long DEFAULT_DELTA_CACHE_SIZE = 50 * 1024 * 1024;
-
- /**
- * Default delta cache limit: {@value}
- *
- * @see #setDeltaCacheLimit(int)
- */
- public static final int DEFAULT_DELTA_CACHE_LIMIT = 100;
-
- /**
- * Default index version: {@value}
- *
- * @see #setIndexVersion(int)
- */
- public static final int DEFAULT_INDEX_VERSION = 2;
-
- /**
- * Default value of the build bitmaps option: {@value}
- *
- * @see #setBuildBitmaps(boolean)
- * @since 3.0
- */
- public static final boolean DEFAULT_BUILD_BITMAPS = true;
-
- /**
- * Default count of most recent commits to select for bitmaps. Only applies
- * when bitmaps are enabled: {@value}
- *
- * @see #setBitmapContiguousCommitCount(int)
- * @since 4.2
- */
- public static final int DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT = 100;
-
- /**
- * Count at which the span between selected commits changes from
- * "bitmapRecentCommitSpan" to "bitmapDistantCommitSpan". Only applies when
- * bitmaps are enabled: {@value}
- *
- * @see #setBitmapRecentCommitCount(int)
- * @since 4.2
- */
- public static final int DEFAULT_BITMAP_RECENT_COMMIT_COUNT = 20000;
-
- /**
- * Default spacing between commits in recent history when selecting commits
- * for bitmaps. Only applies when bitmaps are enabled: {@value}
- *
- * @see #setBitmapRecentCommitSpan(int)
- * @since 4.2
- */
- public static final int DEFAULT_BITMAP_RECENT_COMMIT_SPAN = 100;
-
- /**
- * Default spacing between commits in distant history when selecting commits
- * for bitmaps. Only applies when bitmaps are enabled: {@value}
- *
- * @see #setBitmapDistantCommitSpan(int)
- * @since 4.2
- */
- public static final int DEFAULT_BITMAP_DISTANT_COMMIT_SPAN = 5000;
-
- /**
- * Default count of branches required to activate inactive branch commit
- * selection. If the number of branches is less than this then bitmaps for
- * the entire commit history of all branches will be created, otherwise
- * branches marked as "inactive" will have coverage for only partial
- * history: {@value}
- *
- * @see #setBitmapExcessiveBranchCount(int)
- * @since 4.2
- */
- public static final int DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT = 100;
-
- /**
- * Default age at which a branch is considered inactive. Age is taken as the
- * number of days ago that the most recent commit was made to a branch. Only
- * affects bitmap processing if bitmaps are enabled and the
- * "excessive branch count" has been exceeded: {@value}
- *
- * @see #setBitmapInactiveBranchAgeInDays(int)
- * @since 4.2
- */
- public static final int DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS = 90;
-
- private int compressionLevel = Deflater.DEFAULT_COMPRESSION;
-
- private boolean reuseDeltas = DEFAULT_REUSE_DELTAS;
-
- private boolean reuseObjects = DEFAULT_REUSE_OBJECTS;
-
- private boolean preserveOldPacks = DEFAULT_PRESERVE_OLD_PACKS;
-
- private boolean prunePreserved = DEFAULT_PRUNE_PRESERVED;
-
- private boolean deltaBaseAsOffset = DEFAULT_DELTA_BASE_AS_OFFSET;
-
- private boolean deltaCompress = DEFAULT_DELTA_COMPRESS;
-
- private int maxDeltaDepth = DEFAULT_MAX_DELTA_DEPTH;
-
- private int deltaSearchWindowSize = DEFAULT_DELTA_SEARCH_WINDOW_SIZE;
-
- private long deltaSearchMemoryLimit;
-
- private long deltaCacheSize = DEFAULT_DELTA_CACHE_SIZE;
-
- private int deltaCacheLimit = DEFAULT_DELTA_CACHE_LIMIT;
-
- private int bigFileThreshold = DEFAULT_BIG_FILE_THRESHOLD;
-
- private int threads;
-
- private Executor executor;
-
- private int indexVersion = DEFAULT_INDEX_VERSION;
-
- private boolean buildBitmaps = DEFAULT_BUILD_BITMAPS;
-
- private int bitmapContiguousCommitCount = DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT;
-
- private int bitmapRecentCommitCount = DEFAULT_BITMAP_RECENT_COMMIT_COUNT;
-
- private int bitmapRecentCommitSpan = DEFAULT_BITMAP_RECENT_COMMIT_SPAN;
-
- private int bitmapDistantCommitSpan = DEFAULT_BITMAP_DISTANT_COMMIT_SPAN;
-
- private int bitmapExcessiveBranchCount = DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT;
-
- private int bitmapInactiveBranchAgeInDays = DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS;
-
- private boolean cutDeltaChains;
-
- /** Create a default configuration. */
- public PackConfig() {
- // Fields are initialized to defaults.
- }
-
- /**
- * Create a configuration honoring the repository's settings.
- *
- * @param db
- * the repository to read settings from. The repository is not
- * retained by the new configuration, instead its settings are
- * copied during the constructor.
- */
- public PackConfig(Repository db) {
- fromConfig(db.getConfig());
- }
-
- /**
- * Create a configuration honoring settings in a {@link Config}.
- *
- * @param cfg
- * the source to read settings from. The source is not retained
- * by the new configuration, instead its settings are copied
- * during the constructor.
- */
- public PackConfig(Config cfg) {
- fromConfig(cfg);
- }
-
- /**
- * Copy an existing configuration to a new instance.
- *
- * @param cfg
- * the source configuration to copy from.
- */
- public PackConfig(PackConfig cfg) {
- this.compressionLevel = cfg.compressionLevel;
- this.reuseDeltas = cfg.reuseDeltas;
- this.reuseObjects = cfg.reuseObjects;
- this.preserveOldPacks = cfg.preserveOldPacks;
- this.prunePreserved = cfg.prunePreserved;
- this.deltaBaseAsOffset = cfg.deltaBaseAsOffset;
- this.deltaCompress = cfg.deltaCompress;
- this.maxDeltaDepth = cfg.maxDeltaDepth;
- this.deltaSearchWindowSize = cfg.deltaSearchWindowSize;
- this.deltaSearchMemoryLimit = cfg.deltaSearchMemoryLimit;
- this.deltaCacheSize = cfg.deltaCacheSize;
- this.deltaCacheLimit = cfg.deltaCacheLimit;
- this.bigFileThreshold = cfg.bigFileThreshold;
- this.threads = cfg.threads;
- this.executor = cfg.executor;
- this.indexVersion = cfg.indexVersion;
- this.buildBitmaps = cfg.buildBitmaps;
- this.bitmapContiguousCommitCount = cfg.bitmapContiguousCommitCount;
- this.bitmapRecentCommitCount = cfg.bitmapRecentCommitCount;
- this.bitmapRecentCommitSpan = cfg.bitmapRecentCommitSpan;
- this.bitmapDistantCommitSpan = cfg.bitmapDistantCommitSpan;
- this.bitmapExcessiveBranchCount = cfg.bitmapExcessiveBranchCount;
- this.bitmapInactiveBranchAgeInDays = cfg.bitmapInactiveBranchAgeInDays;
- this.cutDeltaChains = cfg.cutDeltaChains;
- }
-
- /**
- * Check whether to reuse deltas existing in repository.
- *
- * Default setting: {@value #DEFAULT_REUSE_DELTAS}
- *
- * @return true if object is configured to reuse deltas; false otherwise.
- */
- public boolean isReuseDeltas() {
- return reuseDeltas;
- }
-
- /**
- * Set reuse deltas configuration option for the writer.
- *
- * When enabled, writer will search for delta representation of object in
- * repository and use it if possible. Normally, only deltas with base to
- * another object existing in set of objects to pack will be used. The
- * exception however is thin-packs where the base object may exist on the
- * other side.
- *
- * When raw delta data is directly copied from a pack file, its checksum is
- * computed to verify the data is not corrupt.
- *
- * Default setting: {@value #DEFAULT_REUSE_DELTAS}
- *
- * @param reuseDeltas
- * boolean indicating whether or not try to reuse deltas.
- */
- public void setReuseDeltas(boolean reuseDeltas) {
- this.reuseDeltas = reuseDeltas;
- }
-
- /**
- * Checks whether to reuse existing objects representation in repository.
- *
- * Default setting: {@value #DEFAULT_REUSE_OBJECTS}
- *
- * @return true if writer is configured to reuse objects representation from
- * pack; false otherwise.
- */
- public boolean isReuseObjects() {
- return reuseObjects;
- }
-
- /**
- * Set reuse objects configuration option for the writer.
- *
- * If enabled, writer searches for compressed representation in a pack file.
- * If possible, compressed data is directly copied from such a pack file.
- * Data checksum is verified.
- *
- * Default setting: {@value #DEFAULT_REUSE_OBJECTS}
- *
- * @param reuseObjects
- * boolean indicating whether or not writer should reuse existing
- * objects representation.
- */
- public void setReuseObjects(boolean reuseObjects) {
- this.reuseObjects = reuseObjects;
- }
-
- /**
- * Checks whether to preserve old packs in a preserved directory
- *
- * Default setting: {@value #DEFAULT_PRESERVE_OLD_PACKS}
- *
- * @return true if repacking will preserve old pack files.
- * @since 4.7
- */
- public boolean isPreserveOldPacks() {
- return preserveOldPacks;
- }
-
- /**
- * Set preserve old packs configuration option for repacking.
- *
- * If enabled, old pack files are moved into a preserved subdirectory instead
- * of being deleted
- *
- * Default setting: {@value #DEFAULT_PRESERVE_OLD_PACKS}
- *
- * @param preserveOldPacks
- * boolean indicating whether or not preserve old pack files
- * @since 4.7
- */
- public void setPreserveOldPacks(boolean preserveOldPacks) {
- this.preserveOldPacks = preserveOldPacks;
- }
-
- /**
- * Checks whether to remove preserved pack files in a preserved directory
- *
- * Default setting: {@value #DEFAULT_PRUNE_PRESERVED}
- *
- * @return true if repacking will remove preserved pack files.
- * @since 4.7
- */
- public boolean isPrunePreserved() {
- return prunePreserved;
- }
-
- /**
- * Set prune preserved configuration option for repacking.
- *
- * If enabled, preserved pack files are removed from a preserved subdirectory
- *
- * Default setting: {@value #DEFAULT_PRESERVE_OLD_PACKS}
- *
- * @param prunePreserved
- * boolean indicating whether or not preserve old pack files
- * @since 4.7
- */
- public void setPrunePreserved(boolean prunePreserved) {
- this.prunePreserved = prunePreserved;
- }
-
- /**
- * True if writer can use offsets to point to a delta base.
- *
- * If true the writer may choose to use an offset to point to a delta base
- * in the same pack, this is a newer style of reference that saves space.
- * False if the writer has to use the older (and more compatible style) of
- * storing the full ObjectId of the delta base.
- *
- * Default setting: {@value #DEFAULT_DELTA_BASE_AS_OFFSET}
- *
- * @return true if delta base is stored as an offset; false if it is stored
- * as an ObjectId.
- */
- public boolean isDeltaBaseAsOffset() {
- return deltaBaseAsOffset;
- }
-
- /**
- * Set writer delta base format.
- *
- * Delta base can be written as an offset in a pack file (new approach
- * reducing file size) or as an object id (legacy approach, compatible with
- * old readers).
- *
- * Default setting: {@value #DEFAULT_DELTA_BASE_AS_OFFSET}
- *
- * @param deltaBaseAsOffset
- * boolean indicating whether delta base can be stored as an
- * offset.
- */
- public void setDeltaBaseAsOffset(boolean deltaBaseAsOffset) {
- this.deltaBaseAsOffset = deltaBaseAsOffset;
- }
-
- /**
- * Check whether the writer will create new deltas on the fly.
- *
- * Default setting: {@value #DEFAULT_DELTA_COMPRESS}
- *
- * @return true if the writer will create a new delta when either
- * {@link #isReuseDeltas()} is false, or no suitable delta is
- * available for reuse.
- */
- public boolean isDeltaCompress() {
- return deltaCompress;
- }
-
- /**
- * Set whether or not the writer will create new deltas on the fly.
- *
- * Default setting: {@value #DEFAULT_DELTA_COMPRESS}
- *
- * @param deltaCompress
- * true to create deltas when {@link #isReuseDeltas()} is false,
- * or when a suitable delta isn't available for reuse. Set to
- * false to write whole objects instead.
- */
- public void setDeltaCompress(boolean deltaCompress) {
- this.deltaCompress = deltaCompress;
- }
-
- /**
- * Get maximum depth of delta chain set up for the writer.
- *
- * Generated chains are not longer than this value.
- *
- * Default setting: {@value #DEFAULT_MAX_DELTA_DEPTH}
- *
- * @return maximum delta chain depth.
- */
- public int getMaxDeltaDepth() {
- return maxDeltaDepth;
- }
-
- /**
- * Set up maximum depth of delta chain for the writer.
- *
- * Generated chains are not longer than this value. Too low value causes low
- * compression level, while too big makes unpacking (reading) longer.
- *
- * Default setting: {@value #DEFAULT_MAX_DELTA_DEPTH}
- *
- * @param maxDeltaDepth
- * maximum delta chain depth.
- */
- public void setMaxDeltaDepth(int maxDeltaDepth) {
- this.maxDeltaDepth = maxDeltaDepth;
- }
-
- /**
- * @return true if existing delta chains should be cut at
- * {@link #getMaxDeltaDepth()}. Default is false, allowing existing
- * chains to be of any length.
- * @since 3.0
- */
- public boolean getCutDeltaChains() {
- return cutDeltaChains;
- }
-
- /**
- * Enable cutting existing delta chains at {@link #getMaxDeltaDepth()}.
- *
- * By default this is disabled and existing chains are kept at whatever
- * length a prior packer was configured to create. This allows objects to be
- * packed one with a large depth (for example 250), and later to quickly
- * repack the repository with a shorter depth (such as 50), but reusing the
- * complete delta chains created by the earlier 250 depth.
- *
- * @param cut
- * true to cut existing chains.
- * @since 3.0
- */
- public void setCutDeltaChains(boolean cut) {
- cutDeltaChains = cut;
- }
-
- /**
- * Get the number of objects to try when looking for a delta base.
- *
- * This limit is per thread, if 4 threads are used the actual memory used
- * will be 4 times this value.
- *
- * Default setting: {@value #DEFAULT_DELTA_SEARCH_WINDOW_SIZE}
- *
- * @return the object count to be searched.
- */
- public int getDeltaSearchWindowSize() {
- return deltaSearchWindowSize;
- }
-
- /**
- * Set the number of objects considered when searching for a delta base.
- *
- * Default setting: {@value #DEFAULT_DELTA_SEARCH_WINDOW_SIZE}
- *
- * @param objectCount
- * number of objects to search at once. Must be at least 2.
- */
- public void setDeltaSearchWindowSize(int objectCount) {
- if (objectCount <= 2)
- setDeltaCompress(false);
- else
- deltaSearchWindowSize = objectCount;
- }
-
- /**
- * Get maximum number of bytes to put into the delta search window.
- *
- * Default setting is 0, for an unlimited amount of memory usage. Actual
- * memory used is the lower limit of either this setting, or the sum of
- * space used by at most {@link #getDeltaSearchWindowSize()} objects.
- *
- * This limit is per thread, if 4 threads are used the actual memory limit
- * will be 4 times this value.
- *
- * @return the memory limit.
- */
- public long getDeltaSearchMemoryLimit() {
- return deltaSearchMemoryLimit;
- }
-
- /**
- * Set the maximum number of bytes to put into the delta search window.
- *
- * Default setting is 0, for an unlimited amount of memory usage. If the
- * memory limit is reached before {@link #getDeltaSearchWindowSize()} the
- * window size is temporarily lowered.
- *
- * @param memoryLimit
- * Maximum number of bytes to load at once, 0 for unlimited.
- */
- public void setDeltaSearchMemoryLimit(long memoryLimit) {
- deltaSearchMemoryLimit = memoryLimit;
- }
-
- /**
- * Get the size of the in-memory delta cache.
- *
- * This limit is for the entire writer, even if multiple threads are used.
- *
- * Default setting: {@value #DEFAULT_DELTA_CACHE_SIZE}
- *
- * @return maximum number of bytes worth of delta data to cache in memory.
- * If 0 the cache is infinite in size (up to the JVM heap limit
- * anyway). A very tiny size such as 1 indicates the cache is
- * effectively disabled.
- */
- public long getDeltaCacheSize() {
- return deltaCacheSize;
- }
-
- /**
- * Set the maximum number of bytes of delta data to cache.
- *
- * During delta search, up to this many bytes worth of small or hard to
- * compute deltas will be stored in memory. This cache speeds up writing by
- * allowing the cached entry to simply be dumped to the output stream.
- *
- * Default setting: {@value #DEFAULT_DELTA_CACHE_SIZE}
- *
- * @param size
- * number of bytes to cache. Set to 0 to enable an infinite
- * cache, set to 1 (an impossible size for any delta) to disable
- * the cache.
- */
- public void setDeltaCacheSize(long size) {
- deltaCacheSize = size;
- }
-
- /**
- * Maximum size in bytes of a delta to cache.
- *
- * Default setting: {@value #DEFAULT_DELTA_CACHE_LIMIT}
- *
- * @return maximum size (in bytes) of a delta that should be cached.
- */
- public int getDeltaCacheLimit() {
- return deltaCacheLimit;
- }
-
- /**
- * Set the maximum size of a delta that should be cached.
- *
- * During delta search, any delta smaller than this size will be cached, up
- * to the {@link #getDeltaCacheSize()} maximum limit. This speeds up writing
- * by allowing these cached deltas to be output as-is.
- *
- * Default setting: {@value #DEFAULT_DELTA_CACHE_LIMIT}
- *
- * @param size
- * maximum size (in bytes) of a delta to be cached.
- */
- public void setDeltaCacheLimit(int size) {
- deltaCacheLimit = size;
- }
-
- /**
- * Get the maximum file size that will be delta compressed.
- *
- * Files bigger than this setting will not be delta compressed, as they are
- * more than likely already highly compressed binary data files that do not
- * delta compress well, such as MPEG videos.
- *
- * Default setting: {@value #DEFAULT_BIG_FILE_THRESHOLD}
- *
- * @return the configured big file threshold.
- */
- public int getBigFileThreshold() {
- return bigFileThreshold;
- }
-
- /**
- * Set the maximum file size that should be considered for deltas.
- *
- * Default setting: {@value #DEFAULT_BIG_FILE_THRESHOLD}
- *
- * @param bigFileThreshold
- * the limit, in bytes.
- */
- public void setBigFileThreshold(int bigFileThreshold) {
- this.bigFileThreshold = bigFileThreshold;
- }
-
- /**
- * Get the compression level applied to objects in the pack.
- *
- * Default setting: {@value java.util.zip.Deflater#DEFAULT_COMPRESSION}
- *
- * @return current compression level, see {@link java.util.zip.Deflater}.
- */
- public int getCompressionLevel() {
- return compressionLevel;
- }
-
- /**
- * Set the compression level applied to objects in the pack.
- *
- * Default setting: {@value java.util.zip.Deflater#DEFAULT_COMPRESSION}
- *
- * @param level
- * compression level, must be a valid level recognized by the
- * {@link java.util.zip.Deflater} class.
- */
- public void setCompressionLevel(int level) {
- compressionLevel = level;
- }
-
- /**
- * Get the number of threads used during delta compression.
- *
- * Default setting: 0 (auto-detect processors)
- *
- * @return number of threads used for delta compression. 0 will auto-detect
- * the threads to the number of available processors.
- */
- public int getThreads() {
- return threads;
- }
-
- /**
- * Set the number of threads to use for delta compression.
- *
- * During delta compression, if there are enough objects to be considered
- * the writer will start up concurrent threads and allow them to compress
- * different sections of the repository concurrently.
- *
- * An application thread pool can be set by {@link #setExecutor(Executor)}.
- * If not set a temporary pool will be created by the writer, and torn down
- * automatically when compression is over.
- *
- * Default setting: 0 (auto-detect processors)
- *
- * @param threads
- * number of threads to use. If <= 0 the number of available
- * processors for this JVM is used.
- */
- public void setThreads(int threads) {
- this.threads = threads;
- }
-
- /** @return the preferred thread pool to execute delta search on. */
- public Executor getExecutor() {
- return executor;
- }
-
- /**
- * Set the executor to use when using threads.
- *
- * During delta compression if the executor is non-null jobs will be queued
- * up on it to perform delta compression in parallel. Aside from setting the
- * executor, the caller must set {@link #setThreads(int)} to enable threaded
- * delta search.
- *
- * @param executor
- * executor to use for threads. Set to null to create a temporary
- * executor just for the writer.
- */
- public void setExecutor(Executor executor) {
- this.executor = executor;
- }
-
- /**
- * Get the pack index file format version this instance creates.
- *
- * Default setting: {@value #DEFAULT_INDEX_VERSION}
- *
- * @return the index version, the special version 0 designates the oldest
- * (most compatible) format available for the objects.
- * @see PackIndexWriter
- */
- public int getIndexVersion() {
- return indexVersion;
- }
-
- /**
- * Set the pack index file format version this instance will create.
- *
- * Default setting: {@value #DEFAULT_INDEX_VERSION}
- *
- * @param version
- * the version to write. The special version 0 designates the
- * oldest (most compatible) format available for the objects.
- * @see PackIndexWriter
- */
- public void setIndexVersion(int version) {
- indexVersion = version;
- }
-
- /**
- * True if writer is allowed to build bitmaps for indexes.
- *
- * Default setting: {@value #DEFAULT_BUILD_BITMAPS}
- *
- * @return true if delta base is the writer can choose to output an index
- * with bitmaps.
- * @since 3.0
- */
- public boolean isBuildBitmaps() {
- return buildBitmaps;
- }
-
- /**
- * Set writer to allow building bitmaps for supported pack files.
- *
- * Index files can include bitmaps to speed up future ObjectWalks.
- *
- * Default setting: {@value #DEFAULT_BUILD_BITMAPS}
- *
- * @param buildBitmaps
- * boolean indicating whether bitmaps may be included in the
- * index.
- * @since 3.0
- */
- public void setBuildBitmaps(boolean buildBitmaps) {
- this.buildBitmaps = buildBitmaps;
- }
-
- /**
- * Get the count of most recent commits for which to build bitmaps.
- *
- * Default setting: {@value #DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT}
- *
- * @return the count of most recent commits for which to build bitmaps
- * @since 4.2
- */
- public int getBitmapContiguousCommitCount() {
- return bitmapContiguousCommitCount;
- }
-
- /**
- * Set the count of most recent commits for which to build bitmaps.
- *
- * Default setting: {@value #DEFAULT_BITMAP_CONTIGUOUS_COMMIT_COUNT}
- *
- * @param count
- * the count of most recent commits for which to build bitmaps
- * @since 4.2
- */
- public void setBitmapContiguousCommitCount(int count) {
- bitmapContiguousCommitCount = count;
- }
-
- /**
- * Get the count at which to switch from "bitmapRecentCommitSpan" to
- * "bitmapDistantCommitSpan".
- *
- * Default setting: {@value #DEFAULT_BITMAP_RECENT_COMMIT_COUNT}
- *
- * @return the count for switching between recent and distant spans
- * @since 4.2
- */
- public int getBitmapRecentCommitCount() {
- return bitmapRecentCommitCount;
- }
-
- /**
- * Set the count at which to switch from "bitmapRecentCommitSpan" to
- * "bitmapDistantCommitSpan".
- *
- * Default setting: {@value #DEFAULT_BITMAP_RECENT_COMMIT_COUNT}
- *
- * @param count
- * the count for switching between recent and distant spans
- * @since 4.2
- */
- public void setBitmapRecentCommitCount(int count) {
- bitmapRecentCommitCount = count;
- }
-
- /**
- * Get the span of commits when building bitmaps for recent history.
- *
- * Default setting: {@value #DEFAULT_BITMAP_RECENT_COMMIT_SPAN}
- *
- * @return the span of commits when building bitmaps for recent history
- * @since 4.2
- */
- public int getBitmapRecentCommitSpan() {
- return bitmapRecentCommitSpan;
- }
-
- /**
- * Set the span of commits when building bitmaps for recent history.
- *
- * Default setting: {@value #DEFAULT_BITMAP_RECENT_COMMIT_SPAN}
- *
- * @param span
- * the span of commits when building bitmaps for recent history
- * @since 4.2
- */
- public void setBitmapRecentCommitSpan(int span) {
- bitmapRecentCommitSpan = span;
- }
-
- /**
- * Get the span of commits when building bitmaps for distant history.
- *
- * Default setting: {@value #DEFAULT_BITMAP_DISTANT_COMMIT_SPAN}
- *
- * @return the span of commits when building bitmaps for distant history
- * @since 4.2
- */
- public int getBitmapDistantCommitSpan() {
- return bitmapDistantCommitSpan;
- }
-
- /**
- * Set the span of commits when building bitmaps for distant history.
- *
- * Default setting: {@value #DEFAULT_BITMAP_DISTANT_COMMIT_SPAN}
- *
- * @param span
- * the span of commits when building bitmaps for distant history
- * @since 4.2
- */
- public void setBitmapDistantCommitSpan(int span) {
- bitmapDistantCommitSpan = span;
- }
-
- /**
- * Get the count of branches deemed "excessive". If the count of branches in
- * a repository exceeds this number and bitmaps are enabled, "inactive"
- * branches will have fewer bitmaps than "active" branches.
- *
- * Default setting: {@value #DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT}
- *
- * @return the count of branches deemed "excessive"
- * @since 4.2
- */
- public int getBitmapExcessiveBranchCount() {
- return bitmapExcessiveBranchCount;
- }
-
- /**
- * Set the count of branches deemed "excessive". If the count of branches in
- * a repository exceeds this number and bitmaps are enabled, "inactive"
- * branches will have fewer bitmaps than "active" branches.
- *
- * Default setting: {@value #DEFAULT_BITMAP_EXCESSIVE_BRANCH_COUNT}
- *
- * @param count
- * the count of branches deemed "excessive"
- * @since 4.2
- */
- public void setBitmapExcessiveBranchCount(int count) {
- bitmapExcessiveBranchCount = count;
- }
-
- /**
- * Get the the age in days that marks a branch as "inactive".
- *
- * Default setting: {@value #DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS}
- *
- * @return the age in days that marks a branch as "inactive"
- * @since 4.2
- */
- public int getBitmapInactiveBranchAgeInDays() {
- return bitmapInactiveBranchAgeInDays;
- }
-
- /**
- * Set the the age in days that marks a branch as "inactive".
- *
- * Default setting: {@value #DEFAULT_BITMAP_INACTIVE_BRANCH_AGE_IN_DAYS}
- *
- * @param ageInDays
- * the age in days that marks a branch as "inactive"
- * @since 4.2
- */
- public void setBitmapInactiveBranchAgeInDays(int ageInDays) {
- bitmapInactiveBranchAgeInDays = ageInDays;
- }
-
- /**
- * Update properties by setting fields from the configuration.
- *
- * If a property's corresponding variable is not defined in the supplied
- * configuration, then it is left unmodified.
- *
- * @param rc
- * configuration to read properties from.
- */
- public void fromConfig(final Config rc) {
- setMaxDeltaDepth(rc.getInt("pack", "depth", getMaxDeltaDepth())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaSearchWindowSize(rc.getInt(
- "pack", "window", getDeltaSearchWindowSize())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaSearchMemoryLimit(rc.getLong(
- "pack", "windowmemory", getDeltaSearchMemoryLimit())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaCacheSize(rc.getLong(
- "pack", "deltacachesize", getDeltaCacheSize())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaCacheLimit(rc.getInt(
- "pack", "deltacachelimit", getDeltaCacheLimit())); //$NON-NLS-1$ //$NON-NLS-2$
- setCompressionLevel(rc.getInt("pack", "compression", //$NON-NLS-1$ //$NON-NLS-2$
- rc.getInt("core", "compression", getCompressionLevel()))); //$NON-NLS-1$ //$NON-NLS-2$
- setIndexVersion(rc.getInt("pack", "indexversion", getIndexVersion())); //$NON-NLS-1$ //$NON-NLS-2$
- setBigFileThreshold(rc.getInt(
- "core", "bigfilethreshold", getBigFileThreshold())); //$NON-NLS-1$ //$NON-NLS-2$
- setThreads(rc.getInt("pack", "threads", getThreads())); //$NON-NLS-1$ //$NON-NLS-2$
-
- // These variables aren't standardized
- //
- setReuseDeltas(rc.getBoolean("pack", "reusedeltas", isReuseDeltas())); //$NON-NLS-1$ //$NON-NLS-2$
- setReuseObjects(
- rc.getBoolean("pack", "reuseobjects", isReuseObjects())); //$NON-NLS-1$ //$NON-NLS-2$
- setDeltaCompress(
- rc.getBoolean("pack", "deltacompression", isDeltaCompress())); //$NON-NLS-1$ //$NON-NLS-2$
- setCutDeltaChains(
- rc.getBoolean("pack", "cutdeltachains", getCutDeltaChains())); //$NON-NLS-1$ //$NON-NLS-2$
- setBuildBitmaps(
- rc.getBoolean("pack", "buildbitmaps", isBuildBitmaps())); //$NON-NLS-1$ //$NON-NLS-2$
- setBitmapContiguousCommitCount(
- rc.getInt("pack", "bitmapcontiguouscommitcount", //$NON-NLS-1$ //$NON-NLS-2$
- getBitmapContiguousCommitCount()));
- setBitmapRecentCommitCount(rc.getInt("pack", "bitmaprecentcommitcount", //$NON-NLS-1$ //$NON-NLS-2$
- getBitmapRecentCommitCount()));
- setBitmapRecentCommitSpan(rc.getInt("pack", "bitmaprecentcommitspan", //$NON-NLS-1$ //$NON-NLS-2$
- getBitmapRecentCommitSpan()));
- setBitmapDistantCommitSpan(rc.getInt("pack", "bitmapdistantcommitspan", //$NON-NLS-1$ //$NON-NLS-2$
- getBitmapDistantCommitSpan()));
- setBitmapExcessiveBranchCount(rc.getInt("pack", //$NON-NLS-1$
- "bitmapexcessivebranchcount", getBitmapExcessiveBranchCount())); //$NON-NLS-1$
- setBitmapInactiveBranchAgeInDays(
- rc.getInt("pack", "bitmapinactivebranchageindays", //$NON-NLS-1$ //$NON-NLS-2$
- getBitmapInactiveBranchAgeInDays()));
- }
-
- public String toString() {
- final StringBuilder b = new StringBuilder();
- b.append("maxDeltaDepth=").append(getMaxDeltaDepth()); //$NON-NLS-1$
- b.append(", deltaSearchWindowSize=").append(getDeltaSearchWindowSize()); //$NON-NLS-1$
- b.append(", deltaSearchMemoryLimit=") //$NON-NLS-1$
- .append(getDeltaSearchMemoryLimit());
- b.append(", deltaCacheSize=").append(getDeltaCacheSize()); //$NON-NLS-1$
- b.append(", deltaCacheLimit=").append(getDeltaCacheLimit()); //$NON-NLS-1$
- b.append(", compressionLevel=").append(getCompressionLevel()); //$NON-NLS-1$
- b.append(", indexVersion=").append(getIndexVersion()); //$NON-NLS-1$
- b.append(", bigFileThreshold=").append(getBigFileThreshold()); //$NON-NLS-1$
- b.append(", threads=").append(getThreads()); //$NON-NLS-1$
- b.append(", reuseDeltas=").append(isReuseDeltas()); //$NON-NLS-1$
- b.append(", reuseObjects=").append(isReuseObjects()); //$NON-NLS-1$
- b.append(", deltaCompress=").append(isDeltaCompress()); //$NON-NLS-1$
- b.append(", buildBitmaps=").append(isBuildBitmaps()); //$NON-NLS-1$
- b.append(", bitmapContiguousCommitCount=") //$NON-NLS-1$
- .append(getBitmapContiguousCommitCount());
- b.append(", bitmapRecentCommitCount=") //$NON-NLS-1$
- .append(getBitmapRecentCommitCount());
- b.append(", bitmapRecentCommitSpan=") //$NON-NLS-1$
- .append(getBitmapRecentCommitSpan());
- b.append(", bitmapDistantCommitSpan=") //$NON-NLS-1$
- .append(getBitmapDistantCommitSpan());
- b.append(", bitmapExcessiveBranchCount=") //$NON-NLS-1$
- .append(getBitmapExcessiveBranchCount());
- b.append(", bitmapInactiveBranchAge=") //$NON-NLS-1$
- .append(getBitmapInactiveBranchAgeInDays());
- return b.toString();
- }
- }
|