From a77ae764792ea0e248454074c303e43e076ecf0a Mon Sep 17 00:00:00 2001 From: tsantalis Date: Sun, 4 Aug 2024 19:37:31 -0400 Subject: [PATCH] Add source operation of extracted methods in the tracked code elements --- .../java/org/codetracker/FileTrackerImpl.java | 56 + .../MethodTrackerChangeHistory.java | 11 + .../blame/CodeTrackerBlameTest.java | 15 + .../blame/blameTestUntilCommitZero.txt | 4704 ++++++++--------- 4 files changed, 2434 insertions(+), 2352 deletions(-) diff --git a/src/main/java/org/codetracker/FileTrackerImpl.java b/src/main/java/org/codetracker/FileTrackerImpl.java index c3d95c099f2..34d47685ed9 100644 --- a/src/main/java/org/codetracker/FileTrackerImpl.java +++ b/src/main/java/org/codetracker/FileTrackerImpl.java @@ -143,6 +143,33 @@ else if (annotation.getClazz().isPresent()) { return null; } + private Set remainingBlames(Method startMethod) { + Set remaining = new LinkedHashSet(); + for (CodeElement key2 : programElementMap.keySet()) { + if (key2 instanceof Block) { + Block startBlock = (Block)key2; + BlockTrackerChangeHistory startBlockChangeHistory = (BlockTrackerChangeHistory) programElementMap.get(startBlock); + if (startBlock.getOperation().equals(startMethod.getUmlOperation())) { + HistoryInfo historyInfo = startBlockChangeHistory.blameReturn(startBlock); + if (historyInfo == null) { + remaining.add(startBlock); + } + } + } + else if (key2 instanceof Comment) { + Comment startComment = (Comment)key2; + CommentTrackerChangeHistory startCommentChangeHistory = (CommentTrackerChangeHistory) programElementMap.get(startComment); + if (startComment.getOperation().isPresent() && startComment.getOperation().get().equals(startMethod.getUmlOperation())) { + HistoryInfo historyInfo = startCommentChangeHistory.blameReturn(); + if (historyInfo == null) { + remaining.add(startComment); + } + } + } + } + return remaining; + } + public void blame() throws Exception { try (Git git = new Git(repository); RevWalk walk = new RevWalk(repository)) { Version startVersion = gitRepository.getVersion(startCommitId); @@ -772,6 +799,35 @@ else if (key2 instanceof Annotation) { } } } + if (startMethodChangeHistory.peek().isAdded() && startMethodChangeHistory.getSourceOperation() != null) { + Method codeElement = startMethodChangeHistory.getSourceOperation(); + boolean found = false; + for (CodeElement key2 : programElementMap.keySet()) { + if (key2 instanceof Method) { + Method method = (Method)key2; + MethodTrackerChangeHistory methodChangeHistory = (MethodTrackerChangeHistory) programElementMap.get(method); + if (codeElement.getUmlOperation().equals(method.getUmlOperation())) { + found = true; + break; + } + if (codeElement.getUmlOperation() instanceof UMLOperation && method.getUmlOperation() instanceof UMLOperation && + ((UMLOperation)codeElement.getUmlOperation()).equalSignature((UMLOperation)method.getUmlOperation())) { + found = true; + break; + } + if (!methodChangeHistory.isEmpty() && codeElement.getUmlOperation().equals(methodChangeHistory.peek().getUmlOperation())) { + found = true; + break; + } + } + } + if (!found && remainingBlames(startMethod).size() > 0) { + AbstractChangeHistory changeHistory = (AbstractChangeHistory) factory(codeElement); + changeHistory.addFirst((BaseCodeElement) codeElement); + changeHistory.get().addNode((BaseCodeElement) codeElement); + programElementMap.put(codeElement, changeHistory); + } + } } else if(startMethodChangeHistory.isMethodAdded(umlModelDiff, rightMethod.getUmlOperation().getClassName(), currentVersion, parentVersion, rightMethod::equalIdentifierIgnoringVersion, getAllClassesDiff(umlModelDiff))) { for (CodeElement key2 : programElementMap.keySet()) { diff --git a/src/main/java/org/codetracker/MethodTrackerChangeHistory.java b/src/main/java/org/codetracker/MethodTrackerChangeHistory.java index 058604e2ec1..71d96a6d04a 100644 --- a/src/main/java/org/codetracker/MethodTrackerChangeHistory.java +++ b/src/main/java/org/codetracker/MethodTrackerChangeHistory.java @@ -74,12 +74,21 @@ public class MethodTrackerChangeHistory extends AbstractChangeHistory { private final ChangeHistory methodChangeHistory = new ChangeHistory<>(); private final String methodName; private final int methodDeclarationLineNumber; + private Method sourceOperation; public MethodTrackerChangeHistory(String methodName, int methodDeclarationLineNumber) { this.methodName = methodName; this.methodDeclarationLineNumber = methodDeclarationLineNumber; } + public Method getSourceOperation() { + return sourceOperation; + } + + public void setSourceOperation(Method sourceOperation) { + this.sourceOperation = sourceOperation; + } + public ChangeHistory get() { return methodChangeHistory; } @@ -368,6 +377,8 @@ public Set analyseMethodRefactorings(Collection refactoring .refactoring(extractOperationRefactoring).codeElement(extractedOperationAfter).hookedElement(Method.of(operationBefore, parentVersion))); methodChangeHistory.connectRelatedNodes(); leftMethodSet.add(extractedOperationBefore); + Method sourceOperationBefore = Method.of(operationBefore, parentVersion); + setSourceOperation(sourceOperationBefore); return leftMethodSet; } UMLOperationBodyMapper mapper = extractOperationRefactoring.getBodyMapper(); diff --git a/src/test/java/org/codetracker/blame/CodeTrackerBlameTest.java b/src/test/java/org/codetracker/blame/CodeTrackerBlameTest.java index d84ae78e1bc..2375d4a6d66 100644 --- a/src/test/java/org/codetracker/blame/CodeTrackerBlameTest.java +++ b/src/test/java/org/codetracker/blame/CodeTrackerBlameTest.java @@ -82,6 +82,21 @@ public void testBlameWithLocalRepoUsingFileTracker2() throws Exception { assertEqualWithFile(expectedFilePath, actual); } + @Test + public void testBlameWithLocalRepoUsingFileTrackerUntilCommitZero() throws Exception { + String url = "https://github.com/eclipse/jgit/commit/bd1a82502680b5de5bf86f6c4470185fd1602386"; + String filePath = "org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java"; + String expectedFilePath = System.getProperty("user.dir") + "/src/test/resources/blame/blameTestUntilCommitZero.txt"; + String commitId = URLHelper.getCommit(url); + Repository repository = gitService.cloneIfNotExists(REPOS_PATH + "/" + getOwner(url) + "/" + getProject(url), URLHelper.getRepo(url)); + FileTrackerImpl fileTracker = new FileTrackerImpl(repository, commitId, filePath); + fileTracker.blame(); + BlameFormatter blameFormatter = new BlameFormatter(fileTracker.getLines()); + List results = blameFormatter.make(fileTracker.getBlameInfo()); + String actual = TabularPrint.make(results); + assertEqualWithFile(expectedFilePath, actual); + } + @Test public void testBlameWithLocalRepo() throws Exception { String url = "https://github.com/pouryafard75/DiffBenchmark/commit/5b33dc6f8cfcf8c0e31966c035b0406eca97ec76"; diff --git a/src/test/resources/blame/blameTestUntilCommitZero.txt b/src/test/resources/blame/blameTestUntilCommitZero.txt index 4bd7af7e1f1..26e4fad2672 100644 --- a/src/test/resources/blame/blameTestUntilCommitZero.txt +++ b/src/test/resources/blame/blameTestUntilCommitZero.txt @@ -1,2352 +1,2352 @@ -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 1) /* -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 2) * Copyright (C) 2008-2010, Google Inc. -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 3) * Copyright (C) 2008, Marek Zawirski -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 4) * and other copyright owners as documented in the project's IP log. -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 5) * -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 6) * This program and the accompanying materials are made available -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 7) * under the terms of the Eclipse Distribution License v1.0 which -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 8) * accompanies this distribution, is reproduced below, and is -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 9) * available at http://www.eclipse.org/org/documents/edl-v10.php -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 10) * -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 11) * All rights reserved. -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 12) * -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 13) * Redistribution and use in source and binary forms, with or -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 14) * without modification, are permitted provided that the following -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 15) * conditions are met: -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 16) * -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 17) * - Redistributions of source code must retain the above copyright -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 18) * notice, this list of conditions and the following disclaimer. -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 19) * -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 20) * - Redistributions in binary form must reproduce the above -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 21) * copyright notice, this list of conditions and the following -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 22) * disclaimer in the documentation and/or other materials provided -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 23) * with the distribution. -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 24) * -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 25) * - Neither the name of the Eclipse Foundation, Inc. nor the -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 26) * names of its contributors may be used to endorse or promote -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 27) * products derived from this software without specific prior -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 28) * written permission. -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 29) * -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 30) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 31) * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 32) * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 33) * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 34) * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 35) * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 36) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 37) * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 38) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 39) * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 40) * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 41) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 42) * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 43) */ - 44) -f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 45) package org.eclipse.jgit.internal.storage.pack; - 46) -f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 47) import static org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation.PACK_DELTA; -f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 48) import static org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation.PACK_WHOLE; -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 49) import static org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH; -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 50) import static org.eclipse.jgit.lib.Constants.OBJ_BLOB; -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 51) import static org.eclipse.jgit.lib.Constants.OBJ_COMMIT; -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 52) import static org.eclipse.jgit.lib.Constants.OBJ_TAG; -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 53) import static org.eclipse.jgit.lib.Constants.OBJ_TREE; - 54) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 55) import java.io.IOException; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 56) import java.io.OutputStream; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 57) import java.lang.ref.WeakReference; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 58) import java.security.MessageDigest; -71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 59) import java.text.MessageFormat; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 60) import java.util.ArrayList; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 61) import java.util.Arrays; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 62) import java.util.Collection; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 63) import java.util.Collections; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 64) import java.util.Comparator; -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 65) import java.util.HashSet; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 66) import java.util.Iterator; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 67) import java.util.List; -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 68) import java.util.Map; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 69) import java.util.NoSuchElementException; -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 70) import java.util.Set; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 71) import java.util.concurrent.ConcurrentHashMap; -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 72) import java.util.concurrent.ExecutionException; -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 73) import java.util.concurrent.Executor; -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 74) import java.util.concurrent.ExecutorService; -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 75) import java.util.concurrent.Executors; -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 76) import java.util.concurrent.Future; -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 77) import java.util.concurrent.TimeUnit; -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 78) import java.util.zip.CRC32; -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 79) import java.util.zip.CheckedOutputStream; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 80) import java.util.zip.Deflater; -a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 81) import java.util.zip.DeflaterOutputStream; - 82) -4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 83) import org.eclipse.jgit.annotations.NonNull; -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 84) import org.eclipse.jgit.annotations.Nullable; -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 85) import org.eclipse.jgit.errors.CorruptObjectException; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 86) import org.eclipse.jgit.errors.IncorrectObjectTypeException; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 87) import org.eclipse.jgit.errors.LargeObjectException; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 88) import org.eclipse.jgit.errors.MissingObjectException; -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 89) import org.eclipse.jgit.errors.StoredObjectRepresentationNotAvailableException; -95d311f88 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Robin Rosenberg 2012-03-12 10:20:03 -0400 90) import org.eclipse.jgit.internal.JGitText; -f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 91) import org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder; -f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 92) import org.eclipse.jgit.internal.storage.file.PackBitmapIndexWriterV1; -f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 93) import org.eclipse.jgit.internal.storage.file.PackIndexWriter; -ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 94) import org.eclipse.jgit.lib.AnyObjectId; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 95) import org.eclipse.jgit.lib.AsyncObjectSizeQueue; -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 96) import org.eclipse.jgit.lib.BatchingProgressMonitor; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 97) import org.eclipse.jgit.lib.BitmapIndex; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 98) import org.eclipse.jgit.lib.BitmapIndex.BitmapBuilder; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 99) import org.eclipse.jgit.lib.BitmapObject; -ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 100) import org.eclipse.jgit.lib.Constants; -ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 101) import org.eclipse.jgit.lib.NullProgressMonitor; -ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 102) import org.eclipse.jgit.lib.ObjectId; -bd970007b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-13 19:39:30 -0400 103) import org.eclipse.jgit.lib.ObjectIdOwnerMap; -29aa44476 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-12-29 18:32:24 -0500 104) import org.eclipse.jgit.lib.ObjectIdSet; -ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 105) import org.eclipse.jgit.lib.ObjectLoader; -ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 106) import org.eclipse.jgit.lib.ObjectReader; -ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 107) import org.eclipse.jgit.lib.ProgressMonitor; -ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 108) import org.eclipse.jgit.lib.Repository; -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 109) import org.eclipse.jgit.lib.ThreadSafeProgressMonitor; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 110) import org.eclipse.jgit.revwalk.AsyncRevObjectQueue; -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 111) import org.eclipse.jgit.revwalk.BitmapWalker; -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 112) import org.eclipse.jgit.revwalk.DepthWalk; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 113) import org.eclipse.jgit.revwalk.ObjectWalk; -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 114) import org.eclipse.jgit.revwalk.RevCommit; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 115) import org.eclipse.jgit.revwalk.RevFlag; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 116) import org.eclipse.jgit.revwalk.RevObject; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 117) import org.eclipse.jgit.revwalk.RevSort; -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 118) import org.eclipse.jgit.revwalk.RevTag; -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 119) import org.eclipse.jgit.revwalk.RevTree; -f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 120) import org.eclipse.jgit.storage.pack.PackConfig; -d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 121) import org.eclipse.jgit.storage.pack.PackStatistics; -9cbe22283 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 20:20:13 -0400 122) import org.eclipse.jgit.transport.ObjectCountCallback; -9cbe22283 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 20:20:13 -0400 123) import org.eclipse.jgit.transport.WriteAbortedException; -f67e5602a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-07 21:23:39 -0500 124) import org.eclipse.jgit.util.BlockList; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 125) import org.eclipse.jgit.util.TemporaryBuffer; - 126) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 127) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 128) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 129) * PackWriter class is responsible for generating pack files from specified set -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 130) * of objects from repository. This implementation produce pack files in format -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 131) * version 2. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 132) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 133) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 134) * Source of objects may be specified in two ways: -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 135) *

    -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 136) *
  • (usually) by providing sets of interesting and uninteresting objects in -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 137) * repository - all interesting objects and their ancestors except uninteresting -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 138) * objects and their ancestors will be included in pack, or
  • -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 139) *
  • by providing iterator of {@link org.eclipse.jgit.revwalk.RevObject} -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 140) * specifying exact list and order of objects in pack
  • -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 141) *
-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 142) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 143) * Typical usage consists of creating an instance, configuring options, -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 144) * preparing the list of objects by calling {@link #preparePack(Iterator)} or -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 145) * {@link #preparePack(ProgressMonitor, Set, Set)}, and streaming with -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 146) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. If the -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 147) * pack is being stored as a file the matching index can be written out after -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 148) * writing the pack by {@link #writeIndex(OutputStream)}. An optional bitmap -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 149) * index can be made by calling {@link #prepareBitmapIndex(ProgressMonitor)} -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 150) * followed by {@link #writeBitmapIndex(OutputStream)}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 151) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 152) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 153) * Class provide set of configurable options and -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 154) * {@link org.eclipse.jgit.lib.ProgressMonitor} support, as operations may take -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 155) * a long time for big repositories. Deltas searching algorithm is NOT -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 156) * IMPLEMENTED yet - this implementation relies only on deltas and objects -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 157) * reuse. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 158) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 159) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 160) * This class is not thread safe. It is intended to be used in one thread as a -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 161) * single pass to produce one pack. Invoking methods multiple times or out of -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 162) * order is not supported as internal data structures are destroyed during -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 163) * certain phases to save memory when packing large repositories. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 164) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 165) */ -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 166) public class PackWriter implements AutoCloseable { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 167) private static final int PACK_VERSION_GENERATED = 2; - 168) -4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 169) /** Empty set of objects for {@code preparePack()}. */ -5dc30db56 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2016-12-29 19:19:58 -0500 170) public static final Set NONE = Collections.emptySet(); - 171) -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 172) private static final Map, Boolean> instances = -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 173) new ConcurrentHashMap<>(); - 174) -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 175) private static final Iterable instancesIterable = new Iterable() { -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 176) @Override -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 177) public Iterator iterator() { -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 178) return new Iterator() { -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 179) private final Iterator> it = -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 180) instances.keySet().iterator(); -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 181) private PackWriter next; - 182) -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 183) @Override -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 184) public boolean hasNext() { -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 185) if (next != null) -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 186) return true; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 187) while (it.hasNext()) { -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 188) WeakReference ref = it.next(); -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 189) next = ref.get(); -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 190) if (next != null) -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 191) return true; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 192) it.remove(); -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 193) } -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 194) return false; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 195) } - 196) -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 197) @Override -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 198) public PackWriter next() { -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 199) if (hasNext()) { -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 200) PackWriter result = next; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 201) next = null; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 202) return result; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 203) } -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 204) throw new NoSuchElementException(); -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 205) } - 206) -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 207) @Override -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 208) public void remove() { -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 209) throw new UnsupportedOperationException(); -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 210) } -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 211) }; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 212) } -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 213) }; - 214) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 215) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 216) * Get all allocated, non-released PackWriters instances. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 217) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 218) * @return all allocated, non-released PackWriters instances. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 219) */ -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 220) public static Iterable getInstances() { -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 221) return instancesIterable; -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 222) } - 223) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 224) @SuppressWarnings("unchecked") -79a7dd026 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Andrey Loskutov 2015-10-27 19:02:41 -0400 225) BlockList objectsLists[] = new BlockList[OBJ_TAG + 1]; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 226) { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 227) objectsLists[OBJ_COMMIT] = new BlockList<>(); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 228) objectsLists[OBJ_TREE] = new BlockList<>(); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 229) objectsLists[OBJ_BLOB] = new BlockList<>(); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 230) objectsLists[OBJ_TAG] = new BlockList<>(); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 231) } - 232) -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 233) private ObjectIdOwnerMap objectsMap = new ObjectIdOwnerMap<>(); - 234) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 235) // edge objects for thin packs -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 236) private List edgeObjects = new BlockList<>(); - 237) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 238) // Objects the client is known to have already. -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 239) private BitmapBuilder haveObjects; - 240) -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 241) private List cachedPacks = new ArrayList<>(2); - 242) -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 243) private Set tagTargets = NONE; - 244) -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 245) private Set excludeFromBitmapSelection = NONE; - 246) -7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 247) private ObjectIdSet[] excludeInPacks; - 248) -7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 249) private ObjectIdSet excludeInPackLast; - 250) -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 251) private Deflater myDeflater; - 252) -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 253) private final ObjectReader reader; - 254) -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 255) /** {@link #reader} recast to the reuse interface, if it supports it. */ -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 256) private final ObjectReuseAsIs reuseSupport; - 257) -79a7dd026 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Andrey Loskutov 2015-10-27 19:02:41 -0400 258) final PackConfig config; - 259) -d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 260) private final PackStatistics.Accumulator stats; - 261) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 262) private final MutableState state; - 263) -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 264) private final WeakReference selfRef; - 265) -d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 266) private PackStatistics.ObjectType.Accumulator typeStats; - 267) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 268) private List sortedByName; - 269) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 270) private byte packcsum[]; - 271) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 272) private boolean deltaBaseAsOffset; - 273) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 274) private boolean reuseDeltas; - 275) -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 276) private boolean reuseDeltaCommits; - 277) -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 278) private boolean reuseValidate; - 279) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 280) private boolean thin; - 281) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 282) private boolean useCachedPacks; - 283) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 284) private boolean useBitmaps; - 285) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 286) private boolean ignoreMissingUninteresting = true; - 287) -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 288) private boolean pruneCurrentObjectList; - 289) -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 290) private boolean shallowPack; - 291) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 292) private boolean canBuildBitmaps; - 293) -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 294) private boolean indexDisabled; - 295) -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 296) private int depth; - 297) -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 298) private Collection unshallowObjects; - 299) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 300) private PackBitmapIndexBuilder writeBitmaps; - 301) -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 302) private CRC32 crc32; - 303) -53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 304) private ObjectCountCallback callback; - 305) -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 306) private long filterBlobLimit = -1; - 307) -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 308) /** -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 309) * Create writer for specified repository. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 310) *

-10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 311) * Objects for packing are specified in {@link #preparePack(Iterator)} or -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 312) * {@link #preparePack(ProgressMonitor, Set, Set)}. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 313) * -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 314) * @param repo -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 315) * repository where objects are stored. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 316) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 317) public PackWriter(Repository repo) { -515deaf7e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-29 18:12:53 -0400 318) this(repo, repo.newObjectReader()); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 319) } - 320) -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 321) /** -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 322) * Create a writer to load objects from the specified reader. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 323) *

-10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 324) * Objects for packing are specified in {@link #preparePack(Iterator)} or -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 325) * {@link #preparePack(ProgressMonitor, Set, Set)}. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 326) * -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 327) * @param reader -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 328) * reader to read from the repository with. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 329) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 330) public PackWriter(ObjectReader reader) { -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 331) this(new PackConfig(), reader); -515deaf7e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-29 18:12:53 -0400 332) } - 333) -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 334) /** -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 335) * Create writer for specified repository. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 336) *

-10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 337) * Objects for packing are specified in {@link #preparePack(Iterator)} or -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 338) * {@link #preparePack(ProgressMonitor, Set, Set)}. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 339) * -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 340) * @param repo -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 341) * repository where objects are stored. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 342) * @param reader -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 343) * reader to read from the repository with. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 344) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 345) public PackWriter(Repository repo, ObjectReader reader) { -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 346) this(new PackConfig(repo), reader); -515deaf7e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-29 18:12:53 -0400 347) } - 348) -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 349) /** -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 350) * Create writer with a specified configuration. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 351) *

-10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 352) * Objects for packing are specified in {@link #preparePack(Iterator)} or -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 353) * {@link #preparePack(ProgressMonitor, Set, Set)}. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 354) * -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 355) * @param config -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 356) * configuration for the pack writer. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 357) * @param reader -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 358) * reader to read from the repository with. -10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 359) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 360) public PackWriter(PackConfig config, ObjectReader reader) { -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 361) this(config, reader, null); -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 362) } - 363) -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 364) /** -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 365) * Create writer with a specified configuration. -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 366) *

-302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 367) * Objects for packing are specified in {@link #preparePack(Iterator)} or -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 368) * {@link #preparePack(ProgressMonitor, Set, Set)}. -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 369) * -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 370) * @param config -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 371) * configuration for the pack writer. -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 372) * @param reader -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 373) * reader to read from the repository with. -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 374) * @param statsAccumulator -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 375) * accumulator for statics -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 376) */ -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 377) public PackWriter(PackConfig config, final ObjectReader reader, -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 378) @Nullable PackStatistics.Accumulator statsAccumulator) { -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 379) this.config = config; -515deaf7e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-29 18:12:53 -0400 380) this.reader = reader; -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 381) if (reader instanceof ObjectReuseAsIs) -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 382) reuseSupport = ((ObjectReuseAsIs) reader); -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 383) else -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 384) reuseSupport = null; - 385) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 386) deltaBaseAsOffset = config.isDeltaBaseAsOffset(); -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 387) reuseDeltas = config.isReuseDeltas(); -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 388) reuseValidate = true; // be paranoid by default -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 389) stats = statsAccumulator != null ? statsAccumulator -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 390) : new PackStatistics.Accumulator(); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 391) state = new MutableState(); -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 392) selfRef = new WeakReference<>(this); -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 393) instances.put(selfRef, Boolean.TRUE); -302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 394) } - 395) -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 396) /** -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 397) * Set the {@code ObjectCountCallback}. -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 398) *

-061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 399) * It should be set before calling -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 400) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 401) * -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 402) * @param callback -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 403) * the callback to set -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 404) * @return this object for chaining. -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 405) */ -53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 406) public PackWriter setObjectCountCallback(ObjectCountCallback callback) { -53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 407) this.callback = callback; -53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 408) return this; -53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 409) } - 410) -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 411) /** -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 412) * Records the set of shallow commits in the client. -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 413) * -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 414) * @param clientShallowCommits -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 415) * the shallow commits in the client -061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 416) */ -6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 17:49:47 -0400 417) public void setClientShallowCommits(Set clientShallowCommits) { -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 418) stats.clientShallowCommits = Collections -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 419) .unmodifiableSet(new HashSet<>(clientShallowCommits)); -6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 17:49:47 -0400 420) } - 421) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 422) /** -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 423) * Check whether writer can store delta base as an offset (new style -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 424) * reducing pack size) or should store it as an object id (legacy style, -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 425) * compatible with old readers). -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 426) * -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 427) * Default setting: {@value PackConfig#DEFAULT_DELTA_BASE_AS_OFFSET} -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 428) * -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 429) * @return true if delta base is stored as an offset; false if it is stored -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 430) * as an object id. -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 431) */ -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 432) public boolean isDeltaBaseAsOffset() { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 433) return deltaBaseAsOffset; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 434) } - 435) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 436) /** -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 437) * Set writer delta base format. Delta base can be written as an offset in a -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 438) * pack file (new approach reducing file size) or as an object id (legacy -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 439) * approach, compatible with old readers). -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 440) * -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 441) * Default setting: {@value PackConfig#DEFAULT_DELTA_BASE_AS_OFFSET} -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 442) * -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 443) * @param deltaBaseAsOffset -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 444) * boolean indicating whether delta base can be stored as an -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 445) * offset. -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 446) */ -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 447) public void setDeltaBaseAsOffset(boolean deltaBaseAsOffset) { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 448) this.deltaBaseAsOffset = deltaBaseAsOffset; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 449) } - 450) -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 451) /** -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 452) * Check if the writer will reuse commits that are already stored as deltas. -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 453) * -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 454) * @return true if the writer would reuse commits stored as deltas, assuming -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 455) * delta reuse is already enabled. -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 456) */ -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 457) public boolean isReuseDeltaCommits() { -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 458) return reuseDeltaCommits; -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 459) } - 460) -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 461) /** -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 462) * Set the writer to reuse existing delta versions of commits. -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 463) * -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 464) * @param reuse -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 465) * if true, the writer will reuse any commits stored as deltas. -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 466) * By default the writer does not reuse delta commits. -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 467) */ -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 468) public void setReuseDeltaCommits(boolean reuse) { -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 469) reuseDeltaCommits = reuse; -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 470) } - 471) -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 472) /** -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 473) * Check if the writer validates objects before copying them. -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 474) * -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 475) * @return true if validation is enabled; false if the reader will handle -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 476) * object validation as a side-effect of it consuming the output. -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 477) */ -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 478) public boolean isReuseValidatingObjects() { -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 479) return reuseValidate; -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 480) } - 481) -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 482) /** -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 483) * Enable (or disable) object validation during packing. -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 484) * -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 485) * @param validate -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 486) * if true the pack writer will validate an object before it is -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 487) * put into the output. This additional validation work may be -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 488) * necessary to avoid propagating corruption from one local pack -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 489) * file to another local pack file. -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 490) */ -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 491) public void setReuseValidatingObjects(boolean validate) { -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 492) reuseValidate = validate; -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 493) } - 494) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 495) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 496) * Whether this writer is producing a thin pack. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 497) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 498) * @return true if this writer is producing a thin pack. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 499) */ -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 500) public boolean isThin() { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 501) return thin; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 502) } - 503) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 504) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 505) * Whether writer may pack objects with delta base object not within set of -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 506) * objects to pack -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 507) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 508) * @param packthin -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 509) * a boolean indicating whether writer may pack objects with -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 510) * delta base object not within set of objects to pack, but -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 511) * belonging to party repository (uninteresting/boundary) as -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 512) * determined by set; this kind of pack is used only for -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 513) * transport; true - to produce thin pack, false - otherwise. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 514) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 515) public void setThin(boolean packthin) { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 516) thin = packthin; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 517) } - 518) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 519) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 520) * Whether to reuse cached packs. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 521) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 522) * @return {@code true} to reuse cached packs. If true index creation isn't -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 523) * available. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 524) */ -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 525) public boolean isUseCachedPacks() { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 526) return useCachedPacks; -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 527) } - 528) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 529) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 530) * Whether to use cached packs -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 531) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 532) * @param useCached -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 533) * if set to {@code true} and a cached pack is present, it will -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 534) * be appended onto the end of a thin-pack, reducing the amount -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 535) * of working set space and CPU used by PackWriter. Enabling this -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 536) * feature prevents PackWriter from creating an index for the -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 537) * newly created pack, so its only suitable for writing to a -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 538) * network client, where the client will make the index. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 539) */ -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 540) public void setUseCachedPacks(boolean useCached) { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 541) useCachedPacks = useCached; -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 542) } - 543) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 544) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 545) * Whether to use bitmaps -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 546) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 547) * @return {@code true} to use bitmaps for ObjectWalks, if available. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 548) */ -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 549) public boolean isUseBitmaps() { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 550) return useBitmaps; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 551) } - 552) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 553) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 554) * Whether to use bitmaps -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 555) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 556) * @param useBitmaps -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 557) * if set to true, bitmaps will be used when preparing a pack. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 558) */ -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 559) public void setUseBitmaps(boolean useBitmaps) { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 560) this.useBitmaps = useBitmaps; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 561) } - 562) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 563) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 564) * Whether the index file cannot be created by this PackWriter. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 565) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 566) * @return {@code true} if the index file cannot be created by this -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 567) * PackWriter. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 568) */ -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 569) public boolean isIndexDisabled() { -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 570) return indexDisabled || !cachedPacks.isEmpty(); -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 571) } - 572) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 573) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 574) * Whether to disable creation of the index file. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 575) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 576) * @param noIndex -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 577) * {@code true} to disable creation of the index file. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 578) */ -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 579) public void setIndexDisabled(boolean noIndex) { -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 580) this.indexDisabled = noIndex; -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 581) } - 582) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 583) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 584) * Whether to ignore missing uninteresting objects -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 585) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 586) * @return {@code true} to ignore objects that are uninteresting and also -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 587) * not found on local disk; false to throw a -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 588) * {@link org.eclipse.jgit.errors.MissingObjectException} out of -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 589) * {@link #preparePack(ProgressMonitor, Set, Set)} if an -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 590) * uninteresting object is not in the source repository. By default, -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 591) * true, permitting gracefully ignoring of uninteresting objects. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 592) */ -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 593) public boolean isIgnoreMissingUninteresting() { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 594) return ignoreMissingUninteresting; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 595) } - 596) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 597) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 598) * Whether writer should ignore non existing uninteresting objects -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 599) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 600) * @param ignore -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 601) * {@code true} if writer should ignore non existing -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 602) * uninteresting objects during construction set of objects to -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 603) * pack; false otherwise - non existing uninteresting objects may -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 604) * cause {@link org.eclipse.jgit.errors.MissingObjectException} -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 605) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 606) public void setIgnoreMissingUninteresting(boolean ignore) { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 607) ignoreMissingUninteresting = ignore; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 608) } - 609) -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 610) /** -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 611) * Set the tag targets that should be hoisted earlier during packing. -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 612) *

-8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 613) * Callers may put objects into this set before invoking any of the -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 614) * preparePack methods to influence where an annotated tag's target is -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 615) * stored within the resulting pack. Typically these will be clustered -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 616) * together, and hoisted earlier in the file even if they are ancient -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 617) * revisions, allowing readers to find tag targets with better locality. -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 618) * -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 619) * @param objects -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 620) * objects that annotated tags point at. -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 621) */ -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 622) public void setTagTargets(Set objects) { -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 623) tagTargets = objects; -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 624) } - 625) -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 626) /** -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 627) * Configure this pack for a shallow clone. -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 628) * -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 629) * @param depth -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 630) * maximum depth of history to return. 1 means return only the -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 631) * "wants". -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 632) * @param unshallow -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 633) * objects which used to be shallow on the client, but are being -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 634) * extended as part of this fetch -e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 635) */ -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 636) public void setShallowPack(int depth, -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 637) Collection unshallow) { -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 638) this.shallowPack = true; -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 639) this.depth = depth; -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 640) this.unshallowObjects = unshallow; -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 641) } - 642) -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 643) /** -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 644) * @param bytes exclude blobs of size greater than this -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 645) * @since 5.0 -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 646) */ -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 647) public void setFilterBlobLimit(long bytes) { -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 648) filterBlobLimit = bytes; -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 649) } - 650) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 651) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 652) * Returns objects number in a pack file that was created by this writer. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 653) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 654) * @return number of objects in pack. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 655) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 656) * a cached pack cannot supply its object count. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 657) */ -7a9bf1e2e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:52 -0400 658) public long getObjectCount() throws IOException { -65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 659) if (stats.totalObjects == 0) { -65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 660) long objCnt = 0; - 661) -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 662) objCnt += objectsLists[OBJ_COMMIT].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 663) objCnt += objectsLists[OBJ_TREE].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 664) objCnt += objectsLists[OBJ_BLOB].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 665) objCnt += objectsLists[OBJ_TAG].size(); - 666) -65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 667) for (CachedPack pack : cachedPacks) -65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 668) objCnt += pack.getObjectCount(); -65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 669) return objCnt; -65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 670) } -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 671) return stats.totalObjects; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 672) } - 673) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 674) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 675) * Returns the object ids in the pack file that was created by this writer. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 676) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 677) * This method can only be invoked after -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 678) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)} has -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 679) * been invoked and completed successfully. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 680) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 681) * @return set of objects in pack. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 682) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 683) * a cached pack cannot supply its object ids. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 684) */ -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 685) public ObjectIdOwnerMap getObjectSet() -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 686) throws IOException { -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 687) if (!cachedPacks.isEmpty()) -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 688) throw new IOException( -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 689) JGitText.get().cachedPacksPreventsListingObjects); - 690) -f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 691) if (writeBitmaps != null) { -f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 692) return writeBitmaps.getObjectSet(); -f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 693) } - 694) -f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 695) ObjectIdOwnerMap r = new ObjectIdOwnerMap<>(); -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 696) for (BlockList objList : objectsLists) { -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 697) if (objList != null) { -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 698) for (ObjectToPack otp : objList) -f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 699) r.add(new ObjectIdOwnerMap.Entry(otp) { -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 700) // A new entry that copies the ObjectId -f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 701) }); -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 702) } -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 703) } -f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 704) return r; -7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 705) } - 706) -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 707) /** -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 708) * Add a pack index whose contents should be excluded from the result. -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 709) * -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 710) * @param idx -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 711) * objects in this index will not be in the output pack. -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 712) */ -7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 713) public void excludeObjects(ObjectIdSet idx) { -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 714) if (excludeInPacks == null) { -7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 715) excludeInPacks = new ObjectIdSet[] { idx }; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 716) excludeInPackLast = idx; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 717) } else { -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 718) int cnt = excludeInPacks.length; -7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 719) ObjectIdSet[] newList = new ObjectIdSet[cnt + 1]; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 720) System.arraycopy(excludeInPacks, 0, newList, 0, cnt); -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 721) newList[cnt] = idx; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 722) excludeInPacks = newList; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 723) } -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 724) } - 725) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 726) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 727) * Prepare the list of objects to be written to the pack stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 728) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 729) * Iterator exactly determines which objects are included in a pack -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 730) * and order they appear in pack (except that objects order by type is not -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 731) * needed at input). This order should conform general rules of ordering -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 732) * objects in git - by recency and path (type and delta-base first is -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 733) * internally secured) and responsibility for guaranteeing this order is on -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 734) * a caller side. Iterator must return each id of object to write exactly -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 735) * once. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 736) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 737) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 738) * @param objectsSource -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 739) * iterator of object to store in a pack; order of objects within -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 740) * each type is important, ordering by type is not needed; -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 741) * allowed types for objects are -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 742) * {@link org.eclipse.jgit.lib.Constants#OBJ_COMMIT}, -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 743) * {@link org.eclipse.jgit.lib.Constants#OBJ_TREE}, -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 744) * {@link org.eclipse.jgit.lib.Constants#OBJ_BLOB} and -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 745) * {@link org.eclipse.jgit.lib.Constants#OBJ_TAG}; objects -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 746) * returned by iterator may be later reused by caller as object -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 747) * id and type are internally copied in each iteration. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 748) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 749) * when some I/O problem occur during reading objects. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 750) */ -4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 751) public void preparePack(@NonNull Iterator objectsSource) -4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 752) throws IOException { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 753) while (objectsSource.hasNext()) { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 754) addObject(objectsSource.next()); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 755) } -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 756) } - 757) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 758) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 759) * Prepare the list of objects to be written to the pack stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 760) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 761) * Basing on these 2 sets, another set of objects to put in a pack file is -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 762) * created: this set consists of all objects reachable (ancestors) from -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 763) * interesting objects, except uninteresting objects and their ancestors. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 764) * This method uses class {@link org.eclipse.jgit.revwalk.ObjectWalk} -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 765) * extensively to find out that appropriate set of output objects and their -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 766) * optimal order in output pack. Order is consistent with general git -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 767) * in-pack rules: sort by object type, recency, path and delta-base first. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 768) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 769) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 770) * @param countingMonitor -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 771) * progress during object enumeration. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 772) * @param want -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 773) * collection of objects to be marked as interesting (start -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 774) * points of graph traversal). Must not be {@code null}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 775) * @param have -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 776) * collection of objects to be marked as uninteresting (end -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 777) * points of graph traversal). Pass {@link #NONE} if all objects -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 778) * reachable from {@code want} are desired, such as when serving -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 779) * a clone. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 780) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 781) * when some I/O problem occur during reading objects. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 782) */ -4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 783) public void preparePack(ProgressMonitor countingMonitor, -4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 784) @NonNull Set want, -4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 785) @NonNull Set have) throws IOException { -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 786) preparePack(countingMonitor, want, have, NONE, NONE); -74333e63b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-16 15:18:39 -0400 787) } - 788) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 789) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 790) * Prepare the list of objects to be written to the pack stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 791) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 792) * Like {@link #preparePack(ProgressMonitor, Set, Set)} but also allows -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 793) * specifying commits that should not be walked past ("shallow" commits). -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 794) * The caller is responsible for filtering out commits that should not be -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 795) * shallow any more ("unshallow" commits as in {@link #setShallowPack}) from -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 796) * the shallow set. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 797) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 798) * @param countingMonitor -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 799) * progress during object enumeration. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 800) * @param want -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 801) * objects of interest, ancestors of which will be included in -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 802) * the pack. Must not be {@code null}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 803) * @param have -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 804) * objects whose ancestors (up to and including {@code shallow} -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 805) * commits) do not need to be included in the pack because they -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 806) * are already available from elsewhere. Must not be -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 807) * {@code null}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 808) * @param shallow -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 809) * commits indicating the boundary of the history marked with -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 810) * {@code have}. Shallow commits have parents but those parents -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 811) * are considered not to be already available. Parents of -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 812) * {@code shallow} commits and earlier generations will be -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 813) * included in the pack if requested by {@code want}. Must not be -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 814) * {@code null}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 815) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 816) * an I/O problem occurred while reading objects. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 817) */ -3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 818) public void preparePack(ProgressMonitor countingMonitor, -3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 819) @NonNull Set want, -3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 820) @NonNull Set have, -3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 821) @NonNull Set shallow) throws IOException { -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 822) preparePack(countingMonitor, want, have, shallow, NONE); -3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 823) } - 824) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 825) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 826) * Prepare the list of objects to be written to the pack stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 827) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 828) * Like {@link #preparePack(ProgressMonitor, Set, Set)} but also allows -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 829) * specifying commits that should not be walked past ("shallow" commits). -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 830) * The caller is responsible for filtering out commits that should not be -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 831) * shallow any more ("unshallow" commits as in {@link #setShallowPack}) from -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 832) * the shallow set. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 833) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 834) * @param countingMonitor -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 835) * progress during object enumeration. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 836) * @param want -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 837) * objects of interest, ancestors of which will be included in -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 838) * the pack. Must not be {@code null}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 839) * @param have -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 840) * objects whose ancestors (up to and including {@code shallow} -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 841) * commits) do not need to be included in the pack because they -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 842) * are already available from elsewhere. Must not be -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 843) * {@code null}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 844) * @param shallow -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 845) * commits indicating the boundary of the history marked with -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 846) * {@code have}. Shallow commits have parents but those parents -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 847) * are considered not to be already available. Parents of -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 848) * {@code shallow} commits and earlier generations will be -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 849) * included in the pack if requested by {@code want}. Must not be -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 850) * {@code null}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 851) * @param noBitmaps -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 852) * collection of objects to be excluded from bitmap commit -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 853) * selection. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 854) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 855) * an I/O problem occurred while reading objects. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 856) */ -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 857) public void preparePack(ProgressMonitor countingMonitor, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 858) @NonNull Set want, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 859) @NonNull Set have, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 860) @NonNull Set shallow, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 861) @NonNull Set noBitmaps) throws IOException { -08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 862) try (ObjectWalk ow = getObjectWalk()) { -3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 863) ow.assumeShallow(shallow); -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 864) preparePack(countingMonitor, ow, want, have, noBitmaps); -08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 865) } -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 866) } - 867) -08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 868) private ObjectWalk getObjectWalk() { -08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 869) return shallowPack ? new DepthWalk.ObjectWalk(reader, depth - 1) -08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 870) : new ObjectWalk(reader); -08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 871) } - 872) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 873) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 874) * Prepare the list of objects to be written to the pack stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 875) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 876) * Basing on these 2 sets, another set of objects to put in a pack file is -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 877) * created: this set consists of all objects reachable (ancestors) from -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 878) * interesting objects, except uninteresting objects and their ancestors. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 879) * This method uses class {@link org.eclipse.jgit.revwalk.ObjectWalk} -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 880) * extensively to find out that appropriate set of output objects and their -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 881) * optimal order in output pack. Order is consistent with general git -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 882) * in-pack rules: sort by object type, recency, path and delta-base first. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 883) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 884) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 885) * @param countingMonitor -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 886) * progress during object enumeration. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 887) * @param walk -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 888) * ObjectWalk to perform enumeration. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 889) * @param interestingObjects -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 890) * collection of objects to be marked as interesting (start -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 891) * points of graph traversal). Must not be {@code null}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 892) * @param uninterestingObjects -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 893) * collection of objects to be marked as uninteresting (end -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 894) * points of graph traversal). Pass {@link #NONE} if all objects -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 895) * reachable from {@code want} are desired, such as when serving -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 896) * a clone. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 897) * @param noBitmaps -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 898) * collection of objects to be excluded from bitmap commit -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 899) * selection. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 900) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 901) * when some I/O problem occur during reading objects. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 902) */ -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 903) public void preparePack(ProgressMonitor countingMonitor, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 904) @NonNull ObjectWalk walk, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 905) @NonNull Set interestingObjects, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 906) @NonNull Set uninterestingObjects, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 907) @NonNull Set noBitmaps) -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 908) throws IOException { -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 909) if (countingMonitor == null) -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 910) countingMonitor = NullProgressMonitor.INSTANCE; -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 911) if (shallowPack && !(walk instanceof DepthWalk.ObjectWalk)) -d385a7a5e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 18:37:36 -0400 912) throw new IllegalArgumentException( -d385a7a5e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 18:37:36 -0400 913) JGitText.get().shallowPacksRequireDepthWalk); -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 914) findObjectsToPack(countingMonitor, walk, interestingObjects, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 915) uninterestingObjects, noBitmaps); -74333e63b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-16 15:18:39 -0400 916) } - 917) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 918) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 919) * Determine if the pack file will contain the requested object. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 920) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 921) * @param id -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 922) * the object to test the existence of. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 923) * @return true if the object will appear in the output pack file. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 924) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 925) * a cached pack cannot be examined. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 926) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 927) public boolean willInclude(AnyObjectId id) throws IOException { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 928) ObjectToPack obj = objectsMap.get(id); -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 929) return obj != null && !obj.isEdge(); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 930) } - 931) -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 932) /** -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 933) * Lookup the ObjectToPack object for a given ObjectId. -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 934) * -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 935) * @param id -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 936) * the object to find in the pack. -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 937) * @return the object we are packing, or null. -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 938) */ -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 939) public ObjectToPack get(AnyObjectId id) { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 940) ObjectToPack obj = objectsMap.get(id); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 941) return obj != null && !obj.isEdge() ? obj : null; -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 942) } - 943) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 944) /** -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 945) * Computes SHA-1 of lexicographically sorted objects ids written in this -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 946) * pack, as used to name a pack file in repository. -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 947) * -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 948) * @return ObjectId representing SHA-1 name of a pack that was created. -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 949) */ -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 950) public ObjectId computeName() { -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 951) final byte[] buf = new byte[OBJECT_ID_LENGTH]; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 952) final MessageDigest md = Constants.newMessageDigest(); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 953) for (ObjectToPack otp : sortByName()) { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 954) otp.copyRawTo(buf, 0); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 955) md.update(buf, 0, OBJECT_ID_LENGTH); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 956) } -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 957) return ObjectId.fromRaw(md.digest()); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 958) } - 959) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 960) /** -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 961) * Returns the index format version that will be written. -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 962) *

-dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 963) * This method can only be invoked after -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 964) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)} has -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 965) * been invoked and completed successfully. -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 966) * -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 967) * @return the index format version. -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 968) */ -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 969) public int getIndexVersion() { -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 970) int indexVersion = config.getIndexVersion(); -616bc74cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:00:46 -0400 971) if (indexVersion <= 0) { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 972) for (BlockList objs : objectsLists) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 973) indexVersion = Math.max(indexVersion, -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 974) PackIndexWriter.oldestPossibleFormat(objs)); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 975) } -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 976) return indexVersion; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 977) } - 978) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 979) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 980) * Create an index file to match the pack file just written. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 981) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 982) * Called after -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 983) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 984) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 985) * Writing an index is only required for local pack storage. Packs sent on -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 986) * the network do not need to create an index. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 987) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 988) * @param indexStream -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 989) * output for the index data. Caller is responsible for closing -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 990) * this stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 991) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 992) * the index data could not be written to the supplied stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 993) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 994) public void writeIndex(OutputStream indexStream) throws IOException { -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 995) if (isIndexDisabled()) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 996) throw new IOException(JGitText.get().cachedPacksPreventsIndexCreation); - 997) -1b6a549ff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-09-14 18:34:55 -0400 998) long writeStart = System.currentTimeMillis(); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 999) final PackIndexWriter iw = PackIndexWriter.createVersion( -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1000) indexStream, getIndexVersion()); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1001) iw.write(sortByName(), packcsum); -1b6a549ff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-09-14 18:34:55 -0400 1002) stats.timeWriting += System.currentTimeMillis() - writeStart; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1003) } - 1004) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1005) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1006) * Create a bitmap index file to match the pack file just written. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1007) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1008) * Called after {@link #prepareBitmapIndex(ProgressMonitor)}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1009) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1010) * @param bitmapIndexStream -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1011) * output for the bitmap index data. Caller is responsible for -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1012) * closing this stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1013) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1014) * the index data could not be written to the supplied stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1015) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 1016) public void writeBitmapIndex(OutputStream bitmapIndexStream) -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 1017) throws IOException { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1018) if (writeBitmaps == null) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1019) throw new IOException(JGitText.get().bitmapsMustBePrepared); - 1020) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1021) long writeStart = System.currentTimeMillis(); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1022) final PackBitmapIndexWriterV1 iw = new PackBitmapIndexWriterV1(bitmapIndexStream); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1023) iw.write(writeBitmaps, packcsum); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1024) stats.timeWriting += System.currentTimeMillis() - writeStart; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1025) } - 1026) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1027) private List sortByName() { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1028) if (sortedByName == null) { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1029) int cnt = 0; -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1030) cnt += objectsLists[OBJ_COMMIT].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1031) cnt += objectsLists[OBJ_TREE].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1032) cnt += objectsLists[OBJ_BLOB].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1033) cnt += objectsLists[OBJ_TAG].size(); - 1034) -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1035) sortedByName = new BlockList<>(cnt); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1036) sortedByName.addAll(objectsLists[OBJ_COMMIT]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1037) sortedByName.addAll(objectsLists[OBJ_TREE]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1038) sortedByName.addAll(objectsLists[OBJ_BLOB]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1039) sortedByName.addAll(objectsLists[OBJ_TAG]); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1040) Collections.sort(sortedByName); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1041) } -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1042) return sortedByName; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1043) } - 1044) -1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1045) private void beginPhase(PackingPhase phase, ProgressMonitor monitor, -1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1046) long cnt) { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1047) state.phase = phase; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1048) String task; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1049) switch (phase) { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1050) case COUNTING: -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1051) task = JGitText.get().countingObjects; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1052) break; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1053) case GETTING_SIZES: -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1054) task = JGitText.get().searchForSizes; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1055) break; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1056) case FINDING_SOURCES: -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1057) task = JGitText.get().searchForReuse; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1058) break; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1059) case COMPRESSING: -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1060) task = JGitText.get().compressingObjects; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1061) break; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1062) case WRITING: -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1063) task = JGitText.get().writingObjects; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1064) break; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1065) case BUILDING_BITMAPS: -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1066) task = JGitText.get().buildingBitmaps; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1067) break; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1068) default: -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1069) throw new IllegalArgumentException( -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1070) MessageFormat.format(JGitText.get().illegalPackingPhase, phase)); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1071) } -1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1072) monitor.beginTask(task, (int) cnt); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1073) } - 1074) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1075) private void endPhase(ProgressMonitor monitor) { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1076) monitor.endTask(); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1077) } - 1078) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1079) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1080) * Write the prepared pack to the supplied stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1081) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1082) * Called after -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1083) * {@link #preparePack(ProgressMonitor, ObjectWalk, Set, Set, Set)} or -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1084) * {@link #preparePack(ProgressMonitor, Set, Set)}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1085) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1086) * Performs delta search if enabled and writes the pack stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1087) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1088) * All reused objects data checksum (Adler32/CRC32) is computed and -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1089) * validated against existing checksum. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1090) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1091) * @param compressMonitor -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1092) * progress monitor to report object compression work. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1093) * @param writeMonitor -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1094) * progress monitor to report the number of objects written. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1095) * @param packStream -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1096) * output stream of pack data. The stream should be buffered by -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1097) * the caller. The caller is responsible for closing the stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1098) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1099) * an error occurred reading a local object's data to include in -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1100) * the pack, or writing compressed object data to the output -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1101) * stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1102) * @throws WriteAbortedException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1103) * the write operation is aborted by -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1104) * {@link org.eclipse.jgit.transport.ObjectCountCallback} . -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1105) */ -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1106) public void writePack(ProgressMonitor compressMonitor, -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1107) ProgressMonitor writeMonitor, OutputStream packStream) -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1108) throws IOException { -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1109) if (compressMonitor == null) -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1110) compressMonitor = NullProgressMonitor.INSTANCE; -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1111) if (writeMonitor == null) -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1112) writeMonitor = NullProgressMonitor.INSTANCE; - 1113) -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1114) excludeInPacks = null; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1115) excludeInPackLast = null; - 1116) -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1117) boolean needSearchForReuse = reuseSupport != null && ( -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1118) reuseDeltas -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1119) || config.isReuseObjects() -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1120) || !cachedPacks.isEmpty()); - 1121) -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1122) if (compressMonitor instanceof BatchingProgressMonitor) { -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1123) long delay = 1000; -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1124) if (needSearchForReuse && config.isDeltaCompress()) -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1125) delay = 500; -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1126) ((BatchingProgressMonitor) compressMonitor).setDelayStart( -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1127) delay, -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1128) TimeUnit.MILLISECONDS); -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1129) } - 1130) -68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1131) if (needSearchForReuse) -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1132) searchForReuse(compressMonitor); -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1133) if (config.isDeltaCompress()) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1134) searchForDeltas(compressMonitor); - 1135) -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1136) crc32 = new CRC32(); -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1137) final PackOutputStream out = new PackOutputStream( -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1138) writeMonitor, -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1139) isIndexDisabled() -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1140) ? packStream -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1141) : new CheckedOutputStream(packStream, crc32), -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1142) this); - 1143) -7a9bf1e2e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:52 -0400 1144) long objCnt = getObjectCount(); -71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 1145) stats.totalObjects = objCnt; -53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 1146) if (callback != null) -53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 1147) callback.setObjectCount(objCnt); -1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1148) beginPhase(PackingPhase.WRITING, writeMonitor, objCnt); -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1149) long writeStart = System.currentTimeMillis(); -bc90ce778 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2014-09-04 15:45:18 -0400 1150) try { -21f76c2a6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1151) out.writeFileHeader(PACK_VERSION_GENERATED, objCnt); -cc6210619 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1152) out.flush(); - 1153) -28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1154) writeObjects(out); -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1155) if (!edgeObjects.isEmpty() || !cachedPacks.isEmpty()) { -d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 1156) for (PackStatistics.ObjectType.Accumulator typeStat : stats.objectTypes) { -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1157) if (typeStat == null) -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1158) continue; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1159) stats.thinPackBytes += typeStat.bytes; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1160) } -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1161) } - 1162) -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1163) stats.reusedPacks = Collections.unmodifiableList(cachedPacks); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1164) for (CachedPack pack : cachedPacks) { -388ba7e00 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1165) long deltaCnt = pack.getDeltaCount(); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1166) stats.reusedObjects += pack.getObjectCount(); -388ba7e00 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1167) stats.reusedDeltas += deltaCnt; -388ba7e00 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1168) stats.totalDeltas += deltaCnt; -6e5c71b35 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-04-24 14:31:22 -0400 1169) reuseSupport.copyPackAsIs(out, pack); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1170) } -f288c27e4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1171) writeChecksum(out); -cc6210619 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1172) out.flush(); -bc90ce778 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2014-09-04 15:45:18 -0400 1173) } finally { -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1174) stats.timeWriting = System.currentTimeMillis() - writeStart; -1b6a549ff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-09-14 18:34:55 -0400 1175) stats.depth = depth; - 1176) -d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 1177) for (PackStatistics.ObjectType.Accumulator typeStat : stats.objectTypes) { -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1178) if (typeStat == null) -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1179) continue; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1180) typeStat.cntDeltas += typeStat.reusedDeltas; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1181) stats.reusedObjects += typeStat.reusedObjects; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1182) stats.reusedDeltas += typeStat.reusedDeltas; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1183) stats.totalDeltas += typeStat.cntDeltas; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1184) } -bc90ce778 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2014-09-04 15:45:18 -0400 1185) } - 1186) -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1187) stats.totalBytes = out.length(); -0e73d3950 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-05-20 18:01:36 -0400 1188) reader.close(); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1189) endPhase(writeMonitor); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1190) } - 1191) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1192) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1193) * Get statistics of what this PackWriter did in order to create the final -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1194) * pack stream. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1195) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1196) * @return description of what this PackWriter did in order to create the -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1197) * final pack stream. This should only be invoked after the calls to -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1198) * create the pack/index/bitmap have completed. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1199) */ -d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 1200) public PackStatistics getStatistics() { -d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 1201) return new PackStatistics(stats); -71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 1202) } - 1203) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1204) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1205) * Get snapshot of the current state of this PackWriter. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1206) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1207) * @return snapshot of the current state of this PackWriter. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1208) */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1209) public State getState() { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1210) return state.snapshot(); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1211) } - 1212) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1213) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1214) * {@inheritDoc} -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1215) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1216) * Release all resources used by this writer. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1217) */ -77030a5e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-02-09 08:11:50 -0500 1218) @Override -77030a5e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-02-09 08:11:50 -0500 1219) public void close() { -77030a5e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-02-09 08:11:50 -0500 1220) reader.close(); -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1221) if (myDeflater != null) { -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1222) myDeflater.end(); -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1223) myDeflater = null; -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1224) } -2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1225) instances.remove(selfRef); -77030a5e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-02-09 08:11:50 -0500 1226) } - 1227) -b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1228) private void searchForReuse(ProgressMonitor monitor) throws IOException { -1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1229) long cnt = 0; -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1230) cnt += objectsLists[OBJ_COMMIT].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1231) cnt += objectsLists[OBJ_TREE].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1232) cnt += objectsLists[OBJ_BLOB].size(); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1233) cnt += objectsLists[OBJ_TAG].size(); - 1234) -7505b9354 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-23 14:56:19 -0500 1235) long start = System.currentTimeMillis(); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1236) beginPhase(PackingPhase.FINDING_SOURCES, monitor, cnt); -36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1237) if (cnt <= 4096) { -36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1238) // For small object counts, do everything as one list. -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1239) BlockList tmp = new BlockList<>((int) cnt); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1240) tmp.addAll(objectsLists[OBJ_TAG]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1241) tmp.addAll(objectsLists[OBJ_COMMIT]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1242) tmp.addAll(objectsLists[OBJ_TREE]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1243) tmp.addAll(objectsLists[OBJ_BLOB]); -36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1244) searchForReuse(monitor, tmp); -36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1245) if (pruneCurrentObjectList) { -36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1246) // If the list was pruned, we need to re-prune the main lists. -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1247) pruneEdgesFromObjectList(objectsLists[OBJ_COMMIT]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1248) pruneEdgesFromObjectList(objectsLists[OBJ_TREE]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1249) pruneEdgesFromObjectList(objectsLists[OBJ_BLOB]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1250) pruneEdgesFromObjectList(objectsLists[OBJ_TAG]); -36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1251) } -36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1252) } else { -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1253) searchForReuse(monitor, objectsLists[OBJ_TAG]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1254) searchForReuse(monitor, objectsLists[OBJ_COMMIT]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1255) searchForReuse(monitor, objectsLists[OBJ_TREE]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1256) searchForReuse(monitor, objectsLists[OBJ_BLOB]); -36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1257) } -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1258) endPhase(monitor); -7505b9354 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-23 14:56:19 -0500 1259) stats.timeSearchingForReuse = System.currentTimeMillis() - start; - 1260) -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1261) if (config.isReuseDeltas() && config.getCutDeltaChains()) { -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1262) cutDeltaChains(objectsLists[OBJ_TREE]); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1263) cutDeltaChains(objectsLists[OBJ_BLOB]); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1264) } -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1265) } - 1266) -0be24ebf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1267) private void searchForReuse(ProgressMonitor monitor, List list) -0be24ebf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1268) throws IOException, MissingObjectException { -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1269) pruneCurrentObjectList = false; -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1270) reuseSupport.selectObjectRepresentation(this, monitor, list); -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1271) if (pruneCurrentObjectList) -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1272) pruneEdgesFromObjectList(list); -0be24ebf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1273) } - 1274) -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1275) private void cutDeltaChains(BlockList list) -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1276) throws IOException { -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1277) int max = config.getMaxDeltaDepth(); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1278) for (int idx = list.size() - 1; idx >= 0; idx--) { -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1279) int d = 0; -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1280) ObjectToPack b = list.get(idx).getDeltaBase(); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1281) while (b != null) { -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1282) if (d < b.getChainLength()) -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1283) break; -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1284) b.setChainLength(++d); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1285) if (d >= max && b.isDeltaRepresentation()) { -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1286) reselectNonDelta(b); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1287) break; -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1288) } -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1289) b = b.getDeltaBase(); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1290) } -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1291) } -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1292) if (config.isDeltaCompress()) { -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1293) for (ObjectToPack otp : list) -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1294) otp.clearChainLength(); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1295) } -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1296) } - 1297) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1298) private void searchForDeltas(ProgressMonitor monitor) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1299) throws MissingObjectException, IncorrectObjectTypeException, -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1300) IOException { -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1301) // Commits and annotated tags tend to have too many differences to -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1302) // really benefit from delta compression. Consequently just don't -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1303) // bother examining those types here. -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1304) // -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1305) ObjectToPack[] list = new ObjectToPack[ -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1306) objectsLists[OBJ_TREE].size() -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1307) + objectsLists[OBJ_BLOB].size() -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1308) + edgeObjects.size()]; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1309) int cnt = 0; -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1310) cnt = findObjectsNeedingDelta(list, cnt, OBJ_TREE); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1311) cnt = findObjectsNeedingDelta(list, cnt, OBJ_BLOB); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1312) if (cnt == 0) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1313) return; -37a10e300 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 09:55:43 -0500 1314) int nonEdgeCnt = cnt; - 1315) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1316) // Queue up any edge objects that we might delta against. We won't -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1317) // be sending these as we assume the other side has them, but we need -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1318) // them in the search phase below. -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1319) // -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1320) for (ObjectToPack eo : edgeObjects) { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1321) eo.setWeight(0); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1322) list[cnt++] = eo; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1323) } - 1324) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1325) // Compute the sizes of the objects so we can do a proper sort. -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1326) // We let the reader skip missing objects if it chooses. For -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1327) // some readers this can be a huge win. We detect missing objects -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1328) // by having set the weights above to 0 and allowing the delta -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1329) // search code to discover the missing object and skip over it, or -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1330) // abort with an exception if we actually had to have it. -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1331) // -7505b9354 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-23 14:56:19 -0500 1332) final long sizingStart = System.currentTimeMillis(); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1333) beginPhase(PackingPhase.GETTING_SIZES, monitor, cnt); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1334) AsyncObjectSizeQueue sizeQueue = reader.getObjectSize( -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1335) Arrays. asList(list).subList(0, cnt), false); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1336) try { -93a27ce72 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 14:25:57 -0400 1337) final long limit = Math.min( -93a27ce72 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 14:25:57 -0400 1338) config.getBigFileThreshold(), -93a27ce72 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 14:25:57 -0400 1339) Integer.MAX_VALUE); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1340) for (;;) { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1341) try { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1342) if (!sizeQueue.next()) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1343) break; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1344) } catch (MissingObjectException notFound) { -29997ab08 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:51 -0500 1345) monitor.update(1); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1346) if (ignoreMissingUninteresting) { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1347) ObjectToPack otp = sizeQueue.getCurrent(); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1348) if (otp != null && otp.isEdge()) { -594d4ceb1 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 13:56:42 -0400 1349) otp.setDoNotDelta(); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1350) continue; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1351) } - 1352) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1353) otp = objectsMap.get(notFound.getObjectId()); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1354) if (otp != null && otp.isEdge()) { -594d4ceb1 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 13:56:42 -0400 1355) otp.setDoNotDelta(); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1356) continue; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1357) } -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1358) } -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1359) throw notFound; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1360) } - 1361) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1362) ObjectToPack otp = sizeQueue.getCurrent(); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1363) if (otp == null) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1364) otp = objectsMap.get(sizeQueue.getObjectId()); - 1365) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1366) long sz = sizeQueue.getSize(); -93a27ce72 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 14:25:57 -0400 1367) if (DeltaIndex.BLKSZ < sz && sz < limit) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1368) otp.setWeight((int) sz); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1369) else -594d4ceb1 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 13:56:42 -0400 1370) otp.setDoNotDelta(); // too small, or too big -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1371) monitor.update(1); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1372) } -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1373) } finally { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1374) sizeQueue.release(); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1375) } -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1376) endPhase(monitor); -7505b9354 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-23 14:56:19 -0500 1377) stats.timeSearchingForSizes = System.currentTimeMillis() - sizingStart; - 1378) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1379) // Sort the objects by path hash so like files are near each other, -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1380) // and then by size descending so that bigger files are first. This -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1381) // applies "Linus' Law" which states that newer files tend to be the -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1382) // bigger ones, because source files grow and hardly ever shrink. -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1383) // -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1384) Arrays.sort(list, 0, cnt, new Comparator() { -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1385) @Override -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1386) public int compare(ObjectToPack a, ObjectToPack b) { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1387) int cmp = (a.isDoNotDelta() ? 1 : 0) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1388) - (b.isDoNotDelta() ? 1 : 0); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1389) if (cmp != 0) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1390) return cmp; - 1391) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1392) cmp = a.getType() - b.getType(); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1393) if (cmp != 0) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1394) return cmp; - 1395) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1396) cmp = (a.getPathHash() >>> 1) - (b.getPathHash() >>> 1); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1397) if (cmp != 0) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1398) return cmp; - 1399) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1400) cmp = (a.getPathHash() & 1) - (b.getPathHash() & 1); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1401) if (cmp != 0) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1402) return cmp; - 1403) -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1404) cmp = (a.isEdge() ? 0 : 1) - (b.isEdge() ? 0 : 1); -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1405) if (cmp != 0) -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1406) return cmp; - 1407) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1408) return b.getWeight() - a.getWeight(); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1409) } -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1410) }); - 1411) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1412) // Above we stored the objects we cannot delta onto the end. -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1413) // Remove them from the list so we don't waste time on them. -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1414) while (0 < cnt && list[cnt - 1].isDoNotDelta()) { -37a10e300 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 09:55:43 -0500 1415) if (!list[cnt - 1].isEdge()) -37a10e300 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 09:55:43 -0500 1416) nonEdgeCnt--; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1417) cnt--; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1418) } -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1419) if (cnt == 0) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1420) return; - 1421) -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1422) final long searchStart = System.currentTimeMillis(); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1423) searchForDeltas(monitor, list, cnt); -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1424) stats.deltaSearchNonEdgeObjects = nonEdgeCnt; -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1425) stats.timeCompressing = System.currentTimeMillis() - searchStart; - 1426) -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1427) for (int i = 0; i < cnt; i++) -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1428) if (!list[i].isEdge() && list[i].isDeltaRepresentation()) -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1429) stats.deltasFound++; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1430) } - 1431) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1432) private int findObjectsNeedingDelta(ObjectToPack[] list, int cnt, int type) { -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1433) for (ObjectToPack otp : objectsLists[type]) { -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1434) if (otp.isDoNotDelta()) // delta is disabled for this path -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1435) continue; -2610eaf38 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-13 20:01:29 -0400 1436) if (otp.isDeltaRepresentation()) // already reusing a delta -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1437) continue; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1438) otp.setWeight(0); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1439) list[cnt++] = otp; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1440) } -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1441) return cnt; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1442) } - 1443) -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1444) private void reselectNonDelta(ObjectToPack otp) throws IOException { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1445) otp.clearDeltaBase(); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1446) otp.clearReuseAsIs(); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1447) boolean old = reuseDeltas; -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1448) reuseDeltas = false; -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1449) reuseSupport.selectObjectRepresentation(this, -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1450) NullProgressMonitor.INSTANCE, -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1451) Collections.singleton(otp)); -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1452) reuseDeltas = old; -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1453) } - 1454) -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1455) private void searchForDeltas(final ProgressMonitor monitor, -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1456) final ObjectToPack[] list, final int cnt) -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1457) throws MissingObjectException, IncorrectObjectTypeException, -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1458) LargeObjectException, IOException { -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1459) int threads = config.getThreads(); -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1460) if (threads == 0) -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1461) threads = Runtime.getRuntime().availableProcessors(); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1462) if (threads <= 1 || cnt <= config.getDeltaSearchWindowSize()) -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1463) singleThreadDeltaSearch(monitor, list, cnt); -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1464) else -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1465) parallelDeltaSearch(monitor, list, cnt, threads); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1466) } - 1467) -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1468) private void singleThreadDeltaSearch(ProgressMonitor monitor, -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1469) ObjectToPack[] list, int cnt) throws IOException { -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1470) long totalWeight = 0; -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1471) for (int i = 0; i < cnt; i++) { -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1472) ObjectToPack o = list[i]; -36c6aecbe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-11-03 18:10:02 -0500 1473) totalWeight += DeltaTask.getAdjustedWeight(o); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1474) } - 1475) -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1476) long bytesPerUnit = 1; -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1477) while (DeltaTask.MAX_METER <= (totalWeight / bytesPerUnit)) -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1478) bytesPerUnit <<= 10; -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1479) int cost = (int) (totalWeight / bytesPerUnit); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1480) if (totalWeight % bytesPerUnit != 0) -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1481) cost++; - 1482) -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1483) beginPhase(PackingPhase.COMPRESSING, monitor, cost); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1484) new DeltaWindow(config, new DeltaCache(config), reader, -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1485) monitor, bytesPerUnit, -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1486) list, 0, cnt).search(); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1487) endPhase(monitor); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1488) } - 1489) -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1490) private void parallelDeltaSearch(ProgressMonitor monitor, -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1491) ObjectToPack[] list, int cnt, int threads) throws IOException { -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1492) DeltaCache dc = new ThreadSafeDeltaCache(config); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1493) ThreadSafeProgressMonitor pm = new ThreadSafeProgressMonitor(monitor); -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1494) DeltaTask.Block taskBlock = new DeltaTask.Block(threads, config, -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1495) reader, dc, pm, -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1496) list, 0, cnt); -21e4aa2b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:31:00 -0400 1497) taskBlock.partitionTasks(); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1498) beginPhase(PackingPhase.COMPRESSING, monitor, taskBlock.cost()); -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1499) pm.startWorkers(taskBlock.tasks.size()); - 1500) -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1501) Executor executor = config.getExecutor(); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1502) final List errors = -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1503) Collections.synchronizedList(new ArrayList(threads)); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1504) if (executor instanceof ExecutorService) { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1505) // Caller supplied us a service, use it directly. -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1506) runTasks((ExecutorService) executor, pm, taskBlock, errors); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1507) } else if (executor == null) { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1508) // Caller didn't give us a way to run the tasks, spawn up a -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1509) // temporary thread pool and make sure it tears down cleanly. -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1510) ExecutorService pool = Executors.newFixedThreadPool(threads); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1511) try { -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1512) runTasks(pool, pm, taskBlock, errors); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1513) } finally { -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1514) pool.shutdown(); -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1515) for (;;) { -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1516) try { -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1517) if (pool.awaitTermination(60, TimeUnit.SECONDS)) -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1518) break; -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1519) } catch (InterruptedException e) { -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1520) throw new IOException( -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1521) JGitText.get().packingCancelledDuringObjectsWriting); -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1522) } -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1523) } -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1524) } -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1525) } else { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1526) // The caller gave us an executor, but it might not do -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1527) // asynchronous execution. Wrap everything and hope it -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1528) // can schedule these for us. -f3ec7cf3f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-18 11:59:45 -0400 1529) for (DeltaTask task : taskBlock.tasks) { -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1530) executor.execute(new Runnable() { -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1531) @Override -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1532) public void run() { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1533) try { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1534) task.call(); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1535) } catch (Throwable failure) { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1536) errors.add(failure); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1537) } -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1538) } -7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1539) }); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1540) } -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1541) try { -bdf535de4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-10-27 11:37:31 -0400 1542) pm.waitForCompletion(); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1543) } catch (InterruptedException ie) { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1544) // We can't abort the other tasks as we have no handle. -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1545) // Cross our fingers and just break out anyway. -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1546) // -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1547) throw new IOException( -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1548) JGitText.get().packingCancelledDuringObjectsWriting); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1549) } -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1550) } - 1551) -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1552) // If any task threw an error, try to report it back as -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1553) // though we weren't using a threaded search algorithm. -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1554) // -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1555) if (!errors.isEmpty()) { -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1556) Throwable err = errors.get(0); -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1557) if (err instanceof Error) -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1558) throw (Error) err; -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1559) if (err instanceof RuntimeException) -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1560) throw (RuntimeException) err; -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1561) if (err instanceof IOException) -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1562) throw (IOException) err; - 1563) -0c259eaf1 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-12-19 18:02:34 -0500 1564) throw new IOException(err.getMessage(), err); -74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1565) } -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1566) endPhase(monitor); -5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1567) } - 1568) -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1569) private static void runTasks(ExecutorService pool, -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1570) ThreadSafeProgressMonitor pm, -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1571) DeltaTask.Block tb, List errors) throws IOException { -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1572) List> futures = new ArrayList<>(tb.tasks.size()); -d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1573) for (DeltaTask task : tb.tasks) -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1574) futures.add(pool.submit(task)); - 1575) -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1576) try { -bdf535de4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-10-27 11:37:31 -0400 1577) pm.waitForCompletion(); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1578) for (Future f : futures) { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1579) try { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1580) f.get(); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1581) } catch (ExecutionException failed) { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1582) errors.add(failed.getCause()); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1583) } -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1584) } -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1585) } catch (InterruptedException ie) { -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1586) for (Future f : futures) -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1587) f.cancel(true); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1588) throw new IOException( -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1589) JGitText.get().packingCancelledDuringObjectsWriting); -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1590) } -1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1591) } - 1592) -28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1593) private void writeObjects(PackOutputStream out) throws IOException { -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1594) writeObjects(out, objectsLists[OBJ_COMMIT]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1595) writeObjects(out, objectsLists[OBJ_TAG]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1596) writeObjects(out, objectsLists[OBJ_TREE]); -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1597) writeObjects(out, objectsLists[OBJ_BLOB]); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1598) } - 1599) -26dffbe04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 1600) private void writeObjects(PackOutputStream out, List list) -26dffbe04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 1601) throws IOException { -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1602) if (list.isEmpty()) -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1603) return; - 1604) -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1605) typeStats = stats.objectTypes[list.get(0).getType()]; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1606) long beginOffset = out.length(); - 1607) -28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1608) if (reuseSupport != null) { -28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1609) reuseSupport.writeObjects(out, list); -28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1610) } else { -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1611) for (ObjectToPack otp : list) -28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1612) out.writeObject(otp); -28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1613) } - 1614) -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1615) typeStats.bytes += out.length() - beginOffset; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1616) typeStats.cntObjects = list.size(); -26dffbe04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 1617) } - 1618) -28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1619) void writeObject(PackOutputStream out, ObjectToPack otp) throws IOException { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1620) if (!otp.isWritten()) -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1621) writeObjectImpl(out, otp); -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1622) } - 1623) -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1624) private void writeObjectImpl(PackOutputStream out, ObjectToPack otp) -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1625) throws IOException { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1626) if (otp.wantWrite()) { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1627) // A cycle exists in this delta chain. This should only occur if a -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1628) // selected object representation disappeared during writing -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1629) // (for example due to a concurrent repack) and a different base -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1630) // was chosen, forcing a cycle. Select something other than a -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1631) // delta, and write this object. -5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1632) reselectNonDelta(otp); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1633) } -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1634) otp.markWantWrite(); - 1635) -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1636) while (otp.isReuseAsIs()) { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1637) writeBase(out, otp.getDeltaBase()); -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1638) if (otp.isWritten()) -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1639) return; // Delta chain cycle caused this to write already. - 1640) -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1641) crc32.reset(); -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1642) otp.setOffset(out.length()); -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1643) try { -1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 1644) reuseSupport.copyObjectAsIs(out, otp, reuseValidate); -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1645) out.endObject(); -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1646) otp.setCRC((int) crc32.getValue()); -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1647) typeStats.reusedObjects++; -71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 1648) if (otp.isDeltaRepresentation()) { -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1649) typeStats.reusedDeltas++; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1650) typeStats.deltaBytes += out.length() - otp.getOffset(); -71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 1651) } -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1652) return; -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1653) } catch (StoredObjectRepresentationNotAvailableException gone) { -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1654) if (otp.getOffset() == out.length()) { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1655) otp.setOffset(0); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1656) otp.clearDeltaBase(); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1657) otp.clearReuseAsIs(); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1658) reuseSupport.selectObjectRepresentation(this, -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1659) NullProgressMonitor.INSTANCE, -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1660) Collections.singleton(otp)); -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1661) continue; -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1662) } else { -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1663) // Object writing already started, we cannot recover. -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1664) // -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1665) CorruptObjectException coe; -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1666) coe = new CorruptObjectException(otp, ""); //$NON-NLS-1$ -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1667) coe.initCause(gone); -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1668) throw coe; -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1669) } -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1670) } -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1671) } - 1672) -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1673) // If we reached here, reuse wasn't possible. -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1674) // -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1675) if (otp.isDeltaRepresentation()) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1676) writeDeltaObjectDeflate(out, otp); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1677) else -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1678) writeWholeObjectDeflate(out, otp); -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1679) out.endObject(); -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1680) otp.setCRC((int) crc32.getValue()); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1681) } - 1682) -60e51251d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1683) private void writeBase(PackOutputStream out, ObjectToPack base) -60e51251d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1684) throws IOException { -60e51251d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1685) if (base != null && !base.isWritten() && !base.isEdge()) -60e51251d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1686) writeObjectImpl(out, base); -ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1687) } - 1688) -f288c27e4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1689) private void writeWholeObjectDeflate(PackOutputStream out, -f288c27e4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1690) final ObjectToPack otp) throws IOException { -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1691) final Deflater deflater = deflater(); -a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1692) final ObjectLoader ldr = reader.open(otp, otp.getType()); - 1693) -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1694) crc32.reset(); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1695) otp.setOffset(out.length()); -a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1696) out.writeHeader(otp, ldr.getSize()); - 1697) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1698) deflater.reset(); -a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1699) DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater); -a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1700) ldr.copyTo(dst); -a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1701) dst.finish(); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1702) } - 1703) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1704) private void writeDeltaObjectDeflate(PackOutputStream out, -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1705) final ObjectToPack otp) throws IOException { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1706) writeBase(out, otp.getDeltaBase()); - 1707) -eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1708) crc32.reset(); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1709) otp.setOffset(out.length()); - 1710) -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1711) DeltaCache.Ref ref = otp.popCachedDelta(); -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1712) if (ref != null) { -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1713) byte[] zbuf = ref.get(); -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1714) if (zbuf != null) { -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1715) out.writeHeader(otp, otp.getCachedSize()); -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1716) out.write(zbuf); -3096a1334 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (James Kolb 2015-12-16 14:06:16 -0500 1717) typeStats.cntDeltas++; -3096a1334 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (James Kolb 2015-12-16 14:06:16 -0500 1718) typeStats.deltaBytes += out.length() - otp.getOffset(); -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1719) return; -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1720) } -a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1721) } - 1722) -f30fe13ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2016-12-19 02:38:41 -0500 1723) try (TemporaryBuffer.Heap delta = delta(otp)) { -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1724) out.writeHeader(otp, delta.length()); - 1725) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1726) Deflater deflater = deflater(); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1727) deflater.reset(); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1728) DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1729) delta.writeTo(dst, null); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1730) dst.finish(); -f30fe13ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2016-12-19 02:38:41 -0500 1731) } -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1732) typeStats.cntDeltas++; -bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1733) typeStats.deltaBytes += out.length() - otp.getOffset(); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1734) } - 1735) -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 1736) private TemporaryBuffer.Heap delta(ObjectToPack otp) -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 1737) throws IOException { -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1738) DeltaIndex index = new DeltaIndex(buffer(otp.getDeltaBaseId())); -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1739) byte[] res = buffer(otp); - 1740) -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1741) // We never would have proposed this pair if the delta would be -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1742) // larger than the unpacked version of the object. So using it -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1743) // as our buffer limit is valid: we will never reach it. -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1744) // -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1745) TemporaryBuffer.Heap delta = new TemporaryBuffer.Heap(res.length); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1746) index.encode(delta, res); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1747) return delta; -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1748) } - 1749) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1750) private byte[] buffer(AnyObjectId objId) throws IOException { -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1751) return buffer(config, reader, objId); -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1752) } - 1753) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1754) static byte[] buffer(PackConfig config, ObjectReader or, AnyObjectId objId) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1755) throws IOException { -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1756) // PackWriter should have already pruned objects that -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1757) // are above the big file threshold, so our chances of -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1758) // the object being below it are very good. We really -dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1759) // shouldn't be here, unless the implementation is odd. - 1760) -c11711f98 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-25 20:05:53 -0400 1761) return or.open(objId).getCachedBytes(config.getBigFileThreshold()); -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1762) } - 1763) -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1764) private Deflater deflater() { -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1765) if (myDeflater == null) -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1766) myDeflater = new Deflater(config.getCompressionLevel()); -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1767) return myDeflater; -ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1768) } - 1769) -f288c27e4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1770) private void writeChecksum(PackOutputStream out) throws IOException { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1771) packcsum = out.getDigest(); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1772) out.write(packcsum); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1773) } - 1774) -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1775) private void findObjectsToPack(@NonNull ProgressMonitor countingMonitor, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1776) @NonNull ObjectWalk walker, @NonNull Set want, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1777) @NonNull Set have, -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1778) @NonNull Set noBitmaps) throws IOException { -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1779) final long countingStart = System.currentTimeMillis(); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1780) beginPhase(PackingPhase.COUNTING, countingMonitor, ProgressMonitor.UNKNOWN); - 1781) -4275c4c1c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1782) stats.interestingObjects = Collections.unmodifiableSet(new HashSet(want)); -4275c4c1c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1783) stats.uninterestingObjects = Collections.unmodifiableSet(new HashSet(have)); -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1784) excludeFromBitmapSelection = noBitmaps; - 1785) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1786) canBuildBitmaps = config.isBuildBitmaps() -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1787) && !shallowPack -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1788) && have.isEmpty() -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1789) && (excludeInPacks == null || excludeInPacks.length == 0); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1790) if (!shallowPack && useBitmaps) { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1791) BitmapIndex bitmapIndex = reader.getBitmapIndex(); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1792) if (bitmapIndex != null) { -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1793) BitmapWalker bitmapWalker = new BitmapWalker( -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1794) walker, bitmapIndex, countingMonitor); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1795) findObjectsToPackUsingBitmaps(bitmapWalker, want, have); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1796) endPhase(countingMonitor); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1797) stats.timeCounting = System.currentTimeMillis() - countingStart; -0e8ac496c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-05-26 17:37:17 -0400 1798) stats.bitmapIndexMisses = bitmapWalker.getCountOfBitmapIndexMisses(); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1799) return; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1800) } -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1801) } - 1802) -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1803) List all = new ArrayList<>(want.size() + have.size()); -2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1804) all.addAll(want); -2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1805) all.addAll(have); - 1806) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1807) final RevFlag include = walker.newFlag("include"); //$NON-NLS-1$ -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1808) final RevFlag added = walker.newFlag("added"); //$NON-NLS-1$ - 1809) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1810) walker.carry(include); - 1811) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1812) int haveEst = have.size(); -2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1813) if (have.isEmpty()) { -c218a0760 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-01-27 11:58:44 -0500 1814) walker.sort(RevSort.COMMIT_TIME_DESC); -c218a0760 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-01-27 11:58:44 -0500 1815) } else { - 1816) walker.sort(RevSort.TOPO); -2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1817) if (thin) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1818) walker.sort(RevSort.BOUNDARY, true); -c218a0760 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-01-27 11:58:44 -0500 1819) } - 1820) -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1821) List wantObjs = new ArrayList<>(want.size()); -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1822) List haveObjs = new ArrayList<>(haveEst); -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1823) List wantTags = new ArrayList<>(want.size()); - 1824) -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1825) // Retrieve the RevWalk's versions of "want" and "have" objects to -d385a7a5e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 18:37:36 -0400 1826) // maintain any state previously set in the RevWalk. -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1827) AsyncRevObjectQueue q = walker.parseAny(all, true); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1828) try { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1829) for (;;) { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1830) try { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1831) RevObject o = q.next(); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1832) if (o == null) -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1833) break; -2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1834) if (have.contains(o)) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1835) haveObjs.add(o); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1836) if (want.contains(o)) { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1837) o.add(include); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1838) wantObjs.add(o); -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1839) if (o instanceof RevTag) -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1840) wantTags.add((RevTag) o); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1841) } -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1842) } catch (MissingObjectException e) { -2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1843) if (ignoreMissingUninteresting -2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1844) && have.contains(e.getObjectId())) -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1845) continue; -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1846) throw e; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1847) } -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1848) } -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1849) } finally { -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1850) q.release(); -f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1851) } - 1852) -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1853) if (!wantTags.isEmpty()) { -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1854) all = new ArrayList<>(wantTags.size()); -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1855) for (RevTag tag : wantTags) -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1856) all.add(tag.getObject()); -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1857) q = walker.parseAny(all, true); -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1858) try { -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1859) while (q.next() != null) { -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1860) // Just need to pop the queue item to parse the object. -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1861) } -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1862) } finally { -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1863) q.release(); -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1864) } -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1865) } - 1866) -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1867) if (walker instanceof DepthWalk.ObjectWalk) { -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1868) DepthWalk.ObjectWalk depthWalk = (DepthWalk.ObjectWalk) walker; -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1869) for (RevObject obj : wantObjs) { -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1870) depthWalk.markRoot(obj); -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1871) } -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1872) // Mark the tree objects associated with "have" commits as -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1873) // uninteresting to avoid writing redundant blobs. A normal RevWalk -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1874) // lazily propagates the "uninteresting" state from a commit to its -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1875) // tree during the walk, but DepthWalks can terminate early so -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1876) // preemptively propagate that state here. -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1877) for (RevObject obj : haveObjs) { -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1878) if (obj instanceof RevCommit) { -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1879) RevTree t = ((RevCommit) obj).getTree(); -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1880) depthWalk.markUninteresting(t); -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1881) } -7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1882) } - 1883) -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1884) if (unshallowObjects != null) { -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1885) for (ObjectId id : unshallowObjects) { -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1886) depthWalk.markUnshallow(walker.parseAny(id)); -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1887) } -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1888) } -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1889) } else { -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1890) for (RevObject obj : wantObjs) -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1891) walker.markStart(obj); -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1892) } -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1893) for (RevObject obj : haveObjs) -19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1894) walker.markUninteresting(obj); - 1895) -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1896) final int maxBases = config.getDeltaSearchWindowSize(); -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1897) Set baseTrees = new HashSet<>(); -3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1898) BlockList commits = new BlockList<>(); -1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1899) Set roots = new HashSet<>(); -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1900) RevCommit c; -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1901) while ((c = walker.next()) != null) { -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1902) if (exclude(c)) -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1903) continue; -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1904) if (c.has(RevFlag.UNINTERESTING)) { -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1905) if (baseTrees.size() <= maxBases) -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1906) baseTrees.add(c.getTree()); -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1907) continue; -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1908) } - 1909) -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1910) commits.add(c); -1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1911) if (c.getParentCount() == 0) { -1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1912) roots.add(c.copy()); -1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1913) } -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1914) countingMonitor.update(1); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1915) } -1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1916) stats.rootCommits = Collections.unmodifiableSet(roots); - 1917) -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1918) if (shallowPack) { -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1919) for (RevCommit cmit : commits) { -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1920) addObject(cmit, 0); -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1921) } -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1922) } else { -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1923) int commitCnt = 0; -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1924) boolean putTagTargets = false; -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1925) for (RevCommit cmit : commits) { -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1926) if (!cmit.has(added)) { -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1927) cmit.add(added); -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1928) addObject(cmit, 0); -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1929) commitCnt++; -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1930) } - 1931) -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1932) for (int i = 0; i < cmit.getParentCount(); i++) { -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1933) RevCommit p = cmit.getParent(i); -0f84b86e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Christian Halstrick 2012-06-04 10:52:36 -0400 1934) if (!p.has(added) && !p.has(RevFlag.UNINTERESTING) -0f84b86e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Christian Halstrick 2012-06-04 10:52:36 -0400 1935) && !exclude(p)) { -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1936) p.add(added); -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1937) addObject(p, 0); -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1938) commitCnt++; -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1939) } -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1940) } - 1941) -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1942) if (!putTagTargets && 4096 < commitCnt) { -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1943) for (ObjectId id : tagTargets) { -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1944) RevObject obj = walker.lookupOrNull(id); -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1945) if (obj instanceof RevCommit -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1946) && obj.has(include) -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1947) && !obj.has(RevFlag.UNINTERESTING) -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1948) && !obj.has(added)) { -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1949) obj.add(added); -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1950) addObject(obj, 0); -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1951) } -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1952) } -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1953) putTagTargets = true; -8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1954) } -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1955) } -9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1956) } -733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1957) commits = null; - 1958) -99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1959) if (thin && !baseTrees.isEmpty()) { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1960) BaseSearch bases = new BaseSearch(countingMonitor, baseTrees, // -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1961) objectsMap, edgeObjects, reader); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1962) RevObject o; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1963) while ((o = walker.nextObject()) != null) { -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1964) if (o.has(RevFlag.UNINTERESTING)) -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1965) continue; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1966) if (exclude(o)) -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1967) continue; - 1968) -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1969) int pathHash = walker.getPathHashCode(); -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1970) byte[] pathBuf = walker.getPathBuffer(); -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1971) int pathLen = walker.getPathLength(); -13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1972) bases.addBase(o.getType(), pathBuf, pathLen, pathHash); -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 1973) filterAndAddObject(o, o.getType(), pathHash, want); -6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1974) countingMonitor.update(1); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1975) } -99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1976) } else { -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1977) RevObject o; -99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1978) while ((o = walker.nextObject()) != null) { -99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1979) if (o.has(RevFlag.UNINTERESTING)) -99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1980) continue; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1981) if (exclude(o)) -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1982) continue; -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 1983) filterAndAddObject(o, o.getType(), walker.getPathHashCode(), want); -99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1984) countingMonitor.update(1); -99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1985) } -99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1986) } - 1987) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1988) for (CachedPack pack : cachedPacks) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1989) countingMonitor.update((int) pack.getObjectCount()); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1990) endPhase(countingMonitor); -c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1991) stats.timeCounting = System.currentTimeMillis() - countingStart; -dd22bc831 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-02 22:49:55 -0400 1992) stats.bitmapIndexMisses = -1; -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1993) } - 1994) -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1995) private void findObjectsToPackUsingBitmaps( -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1996) BitmapWalker bitmapWalker, Set want, -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1997) Set have) -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1998) throws MissingObjectException, IncorrectObjectTypeException, -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1999) IOException { -9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2000) BitmapBuilder haveBitmap = bitmapWalker.findObjects(have, null, true); -9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2001) BitmapBuilder wantBitmap = bitmapWalker.findObjects(want, haveBitmap, -9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2002) false); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2003) BitmapBuilder needBitmap = wantBitmap.andNot(haveBitmap); - 2004) -6e5c71b35 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-04-24 14:31:22 -0400 2005) if (useCachedPacks && reuseSupport != null && !reuseValidate -6e5c71b35 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-04-24 14:31:22 -0400 2006) && (excludeInPacks == null || excludeInPacks.length == 0)) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2007) cachedPacks.addAll( -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2008) reuseSupport.getCachedPacksAndUpdate(needBitmap)); - 2009) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2010) for (BitmapObject obj : needBitmap) { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2011) ObjectId objectId = obj.getObjectId(); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2012) if (exclude(objectId)) { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2013) needBitmap.remove(objectId); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2014) continue; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2015) } -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2016) filterAndAddObject(objectId, obj.getType(), 0, want); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2017) } - 2018) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2019) if (thin) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2020) haveObjects = haveBitmap; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2021) } - 2022) -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2023) private static void pruneEdgesFromObjectList(List list) { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2024) final int size = list.size(); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2025) int src = 0; -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2026) int dst = 0; - 2027) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2028) for (; src < size; src++) { -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2029) ObjectToPack obj = list.get(src); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2030) if (obj.isEdge()) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2031) continue; -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2032) if (dst != src) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2033) list.set(dst, obj); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2034) dst++; -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2035) } - 2036) -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2037) while (dst < list.size()) -f67e5602a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-07 21:23:39 -0500 2038) list.remove(list.size() - 1); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2039) } - 2040) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2041) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2042) * Include one object to the output file. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2043) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2044) * Objects are written in the order they are added. If the same object is -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2045) * added twice, it may be written twice, creating a larger than necessary -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2046) * file. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2047) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2048) * @param object -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2049) * the object to add. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2050) * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2051) * the object is an unsupported type. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2052) */ -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 2053) public void addObject(RevObject object) -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 2054) throws IncorrectObjectTypeException { -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2055) if (!exclude(object)) -065a0a812 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-01-28 10:20:26 -0500 2056) addObject(object, 0); -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 2057) } - 2058) -6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 2059) private void addObject(RevObject object, int pathHashCode) { -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2060) addObject(object, object.getType(), pathHashCode); -2f93a09dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 18:17:26 -0400 2061) } - 2062) -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2063) private void addObject( -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2064) final AnyObjectId src, final int type, final int pathHashCode) { -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2065) final ObjectToPack otp; -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2066) if (reuseSupport != null) -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2067) otp = reuseSupport.newObjectToPack(src, type); -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2068) else -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2069) otp = new ObjectToPack(src, type); -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2070) otp.setPathHash(pathHashCode); -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2071) objectsLists[type].add(otp); -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2072) objectsMap.add(otp); -be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2073) } - 2074) -901e663a6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2018-03-19 19:28:03 -0400 2075) // Adds the given object as an object to be packed, first performing -901e663a6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2018-03-19 19:28:03 -0400 2076) // filtering on blobs at or exceeding a given size. -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2077) private void filterAndAddObject(@NonNull AnyObjectId src, int type, -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2078) int pathHashCode, @NonNull Set want) -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2079) throws IOException { - 2080) -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2081) // Check if this object needs to be rejected, doing the cheaper -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2082) // checks first. -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2083) boolean reject = filterBlobLimit >= 0 && -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2084) type == OBJ_BLOB && -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2085) !want.contains(src) && -32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2086) reader.getObjectSize(src, OBJ_BLOB) > filterBlobLimit; -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2087) if (!reject) { -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2088) addObject(src, type, pathHashCode); -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2089) } -4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2090) } - 2091) -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2092) private boolean exclude(AnyObjectId objectId) { -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2093) if (excludeInPacks == null) -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2094) return false; -7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 2095) if (excludeInPackLast.contains(objectId)) -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2096) return true; -7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 2097) for (ObjectIdSet idx : excludeInPacks) { -7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 2098) if (idx.contains(objectId)) { -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2099) excludeInPackLast = idx; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2100) return true; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2101) } -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2102) } -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2103) return false; -a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2104) } - 2105) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2106) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2107) * Select an object representation for this writer. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2108) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2109) * An {@link org.eclipse.jgit.lib.ObjectReader} implementation should invoke -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2110) * this method once for each representation available for an object, to -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2111) * allow the writer to find the most suitable one for the output. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2112) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2113) * @param otp -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2114) * the object being packed. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2115) * @param next -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2116) * the next available representation from the repository. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2117) */ -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2118) public void select(ObjectToPack otp, StoredObjectRepresentation next) { -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2119) int nFmt = next.getFormat(); - 2120) -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2121) if (!cachedPacks.isEmpty()) { -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2122) if (otp.isEdge()) -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2123) return; -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2124) if ((nFmt == PACK_WHOLE) | (nFmt == PACK_DELTA)) { -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2125) for (CachedPack pack : cachedPacks) { -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2126) if (pack.hasObject(otp, next)) { -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2127) otp.setEdge(); -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2128) otp.clearDeltaBase(); -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2129) otp.clearReuseAsIs(); -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2130) pruneCurrentObjectList = true; -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2131) return; -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2132) } -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2133) } -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2134) } -9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2135) } - 2136) -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2137) if (nFmt == PACK_DELTA && reuseDeltas && reuseDeltaFor(otp)) { -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2138) ObjectId baseId = next.getDeltaBase(); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2139) ObjectToPack ptr = objectsMap.get(baseId); -461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2140) if (ptr != null && !ptr.isEdge()) { -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2141) otp.setDeltaBase(ptr); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2142) otp.setReuseAsIs(); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2143) } else if (thin && have(ptr, baseId)) { -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2144) otp.setDeltaBase(baseId); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2145) otp.setReuseAsIs(); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2146) } else { -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2147) otp.clearDeltaBase(); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2148) otp.clearReuseAsIs(); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2149) } -1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 2150) } else if (nFmt == PACK_WHOLE && config.isReuseObjects()) { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2151) int nWeight = next.getWeight(); -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2152) if (otp.isReuseAsIs() && !otp.isDeltaRepresentation()) { -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2153) // We've chosen another PACK_WHOLE format for this object, -8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2154) // choose the one that has the smaller compressed size. -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2155) // -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2156) if (otp.getWeight() <= nWeight) -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2157) return; -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2158) } -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2159) otp.clearDeltaBase(); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2160) otp.setReuseAsIs(); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2161) otp.setWeight(nWeight); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2162) } else { -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2163) otp.clearDeltaBase(); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2164) otp.clearReuseAsIs(); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2165) } - 2166) -c9707e635 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-12 15:59:02 -0400 2167) otp.setDeltaAttempted(reuseDeltas & next.wasDeltaAttempted()); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2168) otp.select(next); -bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2169) } - 2170) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2171) private final boolean have(ObjectToPack ptr, AnyObjectId objectId) { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2172) return (ptr != null && ptr.isEdge()) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2173) || (haveObjects != null && haveObjects.contains(objectId)); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2174) } - 2175) -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2176) /** -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2177) * Prepares the bitmaps to be written to the bitmap index file. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2178) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2179) * Bitmaps can be used to speed up fetches and clones by storing the entire -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2180) * object graph at selected commits. Writing a bitmap index is an optional -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2181) * feature that not all pack users may require. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2182) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2183) * Called after {@link #writeIndex(OutputStream)}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2184) *

-783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2185) * To reduce memory internal state is cleared during this method, rendering -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2186) * the PackWriter instance useless for anything further than a call to write -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2187) * out the new bitmaps with {@link #writeBitmapIndex(OutputStream)}. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2188) * -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2189) * @param pm -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2190) * progress monitor to report bitmap building work. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2191) * @return whether a bitmap index may be written. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2192) * @throws java.io.IOException -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2193) * when some I/O problem occur during reading objects. -783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2194) */ -f82821728 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:15:19 -0500 2195) public boolean prepareBitmapIndex(ProgressMonitor pm) throws IOException { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2196) if (!canBuildBitmaps || getObjectCount() > Integer.MAX_VALUE -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2197) || !cachedPacks.isEmpty()) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2198) return false; - 2199) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2200) if (pm == null) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2201) pm = NullProgressMonitor.INSTANCE; - 2202) -8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 2203) int numCommits = objectsLists[OBJ_COMMIT].size(); -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2204) List byName = sortByName(); -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2205) sortedByName = null; -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2206) objectsLists = null; -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2207) objectsMap = null; -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2208) writeBitmaps = new PackBitmapIndexBuilder(byName); -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2209) byName = null; - 2210) -80c7884ea org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-10-22 01:12:52 -0400 2211) PackWriterBitmapPreparer bitmapPreparer = new PackWriterBitmapPreparer( -80c7884ea org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-10-22 01:12:52 -0400 2212) reader, writeBitmaps, pm, stats.interestingObjects, config); - 2213) -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 2214) Collection selectedCommits = bitmapPreparer -c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 2215) .selectCommits(numCommits, excludeFromBitmapSelection); - 2216) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2217) beginPhase(PackingPhase.BUILDING_BITMAPS, pm, selectedCommits.size()); - 2218) -ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 2219) BitmapWalker walker = bitmapPreparer.newBitmapWalker(); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2220) AnyObjectId last = null; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2221) for (PackWriterBitmapPreparer.BitmapCommit cmit : selectedCommits) { -8f7d0a4fb org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Zhen Chen 2017-05-03 18:02:33 -0400 2222) if (!cmit.isReuseWalker()) { -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2223) walker = bitmapPreparer.newBitmapWalker(); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2224) } -9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2225) BitmapBuilder bitmap = walker.findObjects( -9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2226) Collections.singleton(cmit), null, false); - 2227) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2228) if (last != null && cmit.isReuseWalker() && !bitmap.contains(last)) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2229) throw new IllegalStateException(MessageFormat.format( -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2230) JGitText.get().bitmapMissingObject, cmit.name(), -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2231) last.name())); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2232) last = cmit; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2233) writeBitmaps.addBitmap(cmit, bitmap.build(), cmit.getFlags()); - 2234) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2235) pm.update(1); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2236) } - 2237) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2238) endPhase(pm); -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2239) return true; -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2240) } - 2241) -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2242) private boolean reuseDeltaFor(ObjectToPack otp) { - 2243) int type = otp.getType(); -01a0699ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 2244) if ((type & 2) != 0) // OBJ_TREE(2) or OBJ_BLOB(3) -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2245) return true; -01a0699ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 2246) if (type == OBJ_COMMIT) -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2247) return reuseDeltaCommits; -01a0699ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 2248) if (type == OBJ_TAG) -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2249) return false; -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2250) return true; -751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2251) } - 2252) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2253) private class MutableState { -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2254) /** Estimated size of a single ObjectToPack instance. */ -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2255) // Assume 64-bit pointers, since this is just an estimate. -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2256) private static final long OBJECT_TO_PACK_SIZE = -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2257) (2 * 8) // Object header -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2258) + (2 * 8) + (2 * 8) // ObjectToPack fields -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2259) + (8 + 8) // PackedObjectInfo fields -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2260) + 8 // ObjectIdOwnerMap fields -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2261) + 40 // AnyObjectId fields -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2262) + 8; // Reference in BlockList - 2263) -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2264) private final long totalDeltaSearchBytes; - 2265) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2266) private volatile PackingPhase phase; - 2267) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2268) MutableState() { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2269) phase = PackingPhase.COUNTING; -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2270) if (config.isDeltaCompress()) { -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2271) int threads = config.getThreads(); -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2272) if (threads <= 0) -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2273) threads = Runtime.getRuntime().availableProcessors(); -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2274) totalDeltaSearchBytes = (threads * config.getDeltaSearchMemoryLimit()) -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2275) + config.getBigFileThreshold(); -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2276) } else -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2277) totalDeltaSearchBytes = 0; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2278) } - 2279) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2280) State snapshot() { -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2281) long objCnt = 0; -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2282) BlockList[] lists = objectsLists; -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2283) if (lists != null) { -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2284) objCnt += lists[OBJ_COMMIT].size(); -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2285) objCnt += lists[OBJ_TREE].size(); -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2286) objCnt += lists[OBJ_BLOB].size(); -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2287) objCnt += lists[OBJ_TAG].size(); -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2288) // Exclude CachedPacks. -4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2289) } - 2290) -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2291) long bytesUsed = OBJECT_TO_PACK_SIZE * objCnt; -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2292) PackingPhase curr = phase; -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2293) if (curr == PackingPhase.COMPRESSING) -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2294) bytesUsed += totalDeltaSearchBytes; -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2295) return new State(curr, bytesUsed); -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2296) } -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2297) } - 2298) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2299) /** Possible states that a PackWriter can be in. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2300) public static enum PackingPhase { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2301) /** Counting objects phase. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2302) COUNTING, - 2303) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2304) /** Getting sizes phase. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2305) GETTING_SIZES, - 2306) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2307) /** Finding sources phase. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2308) FINDING_SOURCES, - 2309) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2310) /** Compressing objects phase. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2311) COMPRESSING, - 2312) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2313) /** Writing objects phase. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2314) WRITING, - 2315) -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2316) /** Building bitmaps phase. */ -dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2317) BUILDING_BITMAPS; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2318) } - 2319) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2320) /** Summary of the current state of a PackWriter. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2321) public class State { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2322) private final PackingPhase phase; - 2323) -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2324) private final long bytesUsed; - 2325) -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2326) State(PackingPhase phase, long bytesUsed) { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2327) this.phase = phase; -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2328) this.bytesUsed = bytesUsed; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2329) } - 2330) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2331) /** @return the PackConfig used to build the writer. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2332) public PackConfig getConfig() { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2333) return config; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2334) } - 2335) -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2336) /** @return the current phase of the writer. */ -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2337) public PackingPhase getPhase() { -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2338) return phase; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2339) } - 2340) -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2341) /** @return an estimate of the total memory used by the writer. */ -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2342) public long estimateBytesUsed() { -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2343) return bytesUsed; -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2344) } - 2345) -c310fa0c8 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Robin Rosenberg 2012-12-27 10:57:38 -0500 2346) @SuppressWarnings("nls") -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2347) @Override -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2348) public String toString() { -f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2349) return "PackWriter.State[" + phase + ", memory=" + bytesUsed + "]"; -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2350) } -16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2351) } -1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 2352) } +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 1) /* +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 2) * Copyright (C) 2008-2010, Google Inc. +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 3) * Copyright (C) 2008, Marek Zawirski +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 4) * and other copyright owners as documented in the project's IP log. +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 5) * +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 6) * This program and the accompanying materials are made available +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 7) * under the terms of the Eclipse Distribution License v1.0 which +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 8) * accompanies this distribution, is reproduced below, and is +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 9) * available at http://www.eclipse.org/org/documents/edl-v10.php +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 10) * +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 11) * All rights reserved. +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 12) * +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 13) * Redistribution and use in source and binary forms, with or +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 14) * without modification, are permitted provided that the following +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 15) * conditions are met: +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 16) * +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 17) * - Redistributions of source code must retain the above copyright +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 18) * notice, this list of conditions and the following disclaimer. +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 19) * +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 20) * - Redistributions in binary form must reproduce the above +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 21) * copyright notice, this list of conditions and the following +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 22) * disclaimer in the documentation and/or other materials provided +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 23) * with the distribution. +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 24) * +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 25) * - Neither the name of the Eclipse Foundation, Inc. nor the +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 26) * names of its contributors may be used to endorse or promote +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 27) * products derived from this software without specific prior +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 28) * written permission. +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 29) * +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 30) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 31) * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 32) * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 33) * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 34) * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 35) * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 36) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 37) * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 38) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 39) * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 40) * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 41) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 42) * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +2156aa894 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-03-12 19:08:14 -0500 43) */ + 44) +f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 45) package org.eclipse.jgit.internal.storage.pack; + 46) +f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 47) import static org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation.PACK_DELTA; +f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 48) import static org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation.PACK_WHOLE; +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 49) import static org.eclipse.jgit.lib.Constants.OBJECT_ID_LENGTH; +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 50) import static org.eclipse.jgit.lib.Constants.OBJ_BLOB; +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 51) import static org.eclipse.jgit.lib.Constants.OBJ_COMMIT; +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 52) import static org.eclipse.jgit.lib.Constants.OBJ_TAG; +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 53) import static org.eclipse.jgit.lib.Constants.OBJ_TREE; + 54) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 55) import java.io.IOException; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 56) import java.io.OutputStream; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 57) import java.lang.ref.WeakReference; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 58) import java.security.MessageDigest; +71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 59) import java.text.MessageFormat; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 60) import java.util.ArrayList; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 61) import java.util.Arrays; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 62) import java.util.Collection; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 63) import java.util.Collections; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 64) import java.util.Comparator; +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 65) import java.util.HashSet; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 66) import java.util.Iterator; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 67) import java.util.List; +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 68) import java.util.Map; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 69) import java.util.NoSuchElementException; +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 70) import java.util.Set; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 71) import java.util.concurrent.ConcurrentHashMap; +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 72) import java.util.concurrent.ExecutionException; +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 73) import java.util.concurrent.Executor; +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 74) import java.util.concurrent.ExecutorService; +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 75) import java.util.concurrent.Executors; +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 76) import java.util.concurrent.Future; +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 77) import java.util.concurrent.TimeUnit; +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 78) import java.util.zip.CRC32; +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 79) import java.util.zip.CheckedOutputStream; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 80) import java.util.zip.Deflater; +a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 81) import java.util.zip.DeflaterOutputStream; + 82) +4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 83) import org.eclipse.jgit.annotations.NonNull; +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 84) import org.eclipse.jgit.annotations.Nullable; +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 85) import org.eclipse.jgit.errors.CorruptObjectException; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 86) import org.eclipse.jgit.errors.IncorrectObjectTypeException; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 87) import org.eclipse.jgit.errors.LargeObjectException; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 88) import org.eclipse.jgit.errors.MissingObjectException; +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 89) import org.eclipse.jgit.errors.StoredObjectRepresentationNotAvailableException; +95d311f88 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Robin Rosenberg 2012-03-12 10:20:03 -0400 90) import org.eclipse.jgit.internal.JGitText; +f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 91) import org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder; +f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 92) import org.eclipse.jgit.internal.storage.file.PackBitmapIndexWriterV1; +f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 93) import org.eclipse.jgit.internal.storage.file.PackIndexWriter; +ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 94) import org.eclipse.jgit.lib.AnyObjectId; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 95) import org.eclipse.jgit.lib.AsyncObjectSizeQueue; +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 96) import org.eclipse.jgit.lib.BatchingProgressMonitor; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 97) import org.eclipse.jgit.lib.BitmapIndex; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 98) import org.eclipse.jgit.lib.BitmapIndex.BitmapBuilder; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 99) import org.eclipse.jgit.lib.BitmapObject; +ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 100) import org.eclipse.jgit.lib.Constants; +ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 101) import org.eclipse.jgit.lib.NullProgressMonitor; +ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 102) import org.eclipse.jgit.lib.ObjectId; +bd970007b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-13 19:39:30 -0400 103) import org.eclipse.jgit.lib.ObjectIdOwnerMap; +29aa44476 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-12-29 18:32:24 -0500 104) import org.eclipse.jgit.lib.ObjectIdSet; +ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 105) import org.eclipse.jgit.lib.ObjectLoader; +ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 106) import org.eclipse.jgit.lib.ObjectReader; +ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 107) import org.eclipse.jgit.lib.ProgressMonitor; +ea21c111c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-26 21:51:12 -0400 108) import org.eclipse.jgit.lib.Repository; +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 109) import org.eclipse.jgit.lib.ThreadSafeProgressMonitor; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 110) import org.eclipse.jgit.revwalk.AsyncRevObjectQueue; +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 111) import org.eclipse.jgit.revwalk.BitmapWalker; +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 112) import org.eclipse.jgit.revwalk.DepthWalk; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 113) import org.eclipse.jgit.revwalk.ObjectWalk; +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 114) import org.eclipse.jgit.revwalk.RevCommit; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 115) import org.eclipse.jgit.revwalk.RevFlag; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 116) import org.eclipse.jgit.revwalk.RevObject; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 117) import org.eclipse.jgit.revwalk.RevSort; +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 118) import org.eclipse.jgit.revwalk.RevTag; +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 119) import org.eclipse.jgit.revwalk.RevTree; +f32b86124 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-03-18 12:30:43 -0400 120) import org.eclipse.jgit.storage.pack.PackConfig; +d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 121) import org.eclipse.jgit.storage.pack.PackStatistics; +9cbe22283 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 20:20:13 -0400 122) import org.eclipse.jgit.transport.ObjectCountCallback; +9cbe22283 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 20:20:13 -0400 123) import org.eclipse.jgit.transport.WriteAbortedException; +f67e5602a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-07 21:23:39 -0500 124) import org.eclipse.jgit.util.BlockList; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 125) import org.eclipse.jgit.util.TemporaryBuffer; + 126) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 127) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 128) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 129) * PackWriter class is responsible for generating pack files from specified set +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 130) * of objects from repository. This implementation produce pack files in format +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 131) * version 2. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 132) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 133) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 134) * Source of objects may be specified in two ways: +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 135) *

    +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 136) *
  • (usually) by providing sets of interesting and uninteresting objects in +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 137) * repository - all interesting objects and their ancestors except uninteresting +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 138) * objects and their ancestors will be included in pack, or
  • +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 139) *
  • by providing iterator of {@link org.eclipse.jgit.revwalk.RevObject} +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 140) * specifying exact list and order of objects in pack
  • +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 141) *
+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 142) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 143) * Typical usage consists of creating an instance, configuring options, +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 144) * preparing the list of objects by calling {@link #preparePack(Iterator)} or +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 145) * {@link #preparePack(ProgressMonitor, Set, Set)}, and streaming with +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 146) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. If the +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 147) * pack is being stored as a file the matching index can be written out after +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 148) * writing the pack by {@link #writeIndex(OutputStream)}. An optional bitmap +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 149) * index can be made by calling {@link #prepareBitmapIndex(ProgressMonitor)} +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 150) * followed by {@link #writeBitmapIndex(OutputStream)}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 151) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 152) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 153) * Class provide set of configurable options and +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 154) * {@link org.eclipse.jgit.lib.ProgressMonitor} support, as operations may take +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 155) * a long time for big repositories. Deltas searching algorithm is NOT +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 156) * IMPLEMENTED yet - this implementation relies only on deltas and objects +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 157) * reuse. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 158) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 159) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 160) * This class is not thread safe. It is intended to be used in one thread as a +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 161) * single pass to produce one pack. Invoking methods multiple times or out of +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 162) * order is not supported as internal data structures are destroyed during +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 163) * certain phases to save memory when packing large repositories. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 164) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 165) */ +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 166) public class PackWriter implements AutoCloseable { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 167) private static final int PACK_VERSION_GENERATED = 2; + 168) +4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 169) /** Empty set of objects for {@code preparePack()}. */ +5dc30db56 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2016-12-29 19:19:58 -0500 170) public static final Set NONE = Collections.emptySet(); + 171) +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 172) private static final Map, Boolean> instances = +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 173) new ConcurrentHashMap<>(); + 174) +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 175) private static final Iterable instancesIterable = new Iterable() { +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 176) @Override +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 177) public Iterator iterator() { +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 178) return new Iterator() { +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 179) private final Iterator> it = +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 180) instances.keySet().iterator(); +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 181) private PackWriter next; + 182) +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 183) @Override +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 184) public boolean hasNext() { +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 185) if (next != null) +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 186) return true; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 187) while (it.hasNext()) { +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 188) WeakReference ref = it.next(); +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 189) next = ref.get(); +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 190) if (next != null) +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 191) return true; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 192) it.remove(); +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 193) } +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 194) return false; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 195) } + 196) +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 197) @Override +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 198) public PackWriter next() { +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 199) if (hasNext()) { +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 200) PackWriter result = next; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 201) next = null; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 202) return result; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 203) } +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 204) throw new NoSuchElementException(); +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 205) } + 206) +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 207) @Override +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 208) public void remove() { +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 209) throw new UnsupportedOperationException(); +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 210) } +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 211) }; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 212) } +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 213) }; + 214) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 215) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 216) * Get all allocated, non-released PackWriters instances. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 217) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 218) * @return all allocated, non-released PackWriters instances. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 219) */ +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 220) public static Iterable getInstances() { +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 221) return instancesIterable; +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 222) } + 223) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 224) @SuppressWarnings("unchecked") +79a7dd026 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Andrey Loskutov 2015-10-27 19:02:41 -0400 225) BlockList objectsLists[] = new BlockList[OBJ_TAG + 1]; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 226) { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 227) objectsLists[OBJ_COMMIT] = new BlockList<>(); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 228) objectsLists[OBJ_TREE] = new BlockList<>(); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 229) objectsLists[OBJ_BLOB] = new BlockList<>(); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 230) objectsLists[OBJ_TAG] = new BlockList<>(); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 231) } + 232) +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 233) private ObjectIdOwnerMap objectsMap = new ObjectIdOwnerMap<>(); + 234) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 235) // edge objects for thin packs +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 236) private List edgeObjects = new BlockList<>(); + 237) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 238) // Objects the client is known to have already. +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 239) private BitmapBuilder haveObjects; + 240) +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 241) private List cachedPacks = new ArrayList<>(2); + 242) +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 243) private Set tagTargets = NONE; + 244) +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 245) private Set excludeFromBitmapSelection = NONE; + 246) +7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 247) private ObjectIdSet[] excludeInPacks; + 248) +7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 249) private ObjectIdSet excludeInPackLast; + 250) +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 251) private Deflater myDeflater; + 252) +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 253) private final ObjectReader reader; + 254) +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 255) /** {@link #reader} recast to the reuse interface, if it supports it. */ +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 256) private final ObjectReuseAsIs reuseSupport; + 257) +79a7dd026 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Andrey Loskutov 2015-10-27 19:02:41 -0400 258) final PackConfig config; + 259) +d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 260) private final PackStatistics.Accumulator stats; + 261) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 262) private final MutableState state; + 263) +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 264) private final WeakReference selfRef; + 265) +d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 266) private PackStatistics.ObjectType.Accumulator typeStats; + 267) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 268) private List sortedByName; + 269) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 270) private byte packcsum[]; + 271) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 272) private boolean deltaBaseAsOffset; + 273) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 274) private boolean reuseDeltas; + 275) +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 276) private boolean reuseDeltaCommits; + 277) +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 278) private boolean reuseValidate; + 279) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 280) private boolean thin; + 281) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 282) private boolean useCachedPacks; + 283) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 284) private boolean useBitmaps; + 285) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 286) private boolean ignoreMissingUninteresting = true; + 287) +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 288) private boolean pruneCurrentObjectList; + 289) +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 290) private boolean shallowPack; + 291) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 292) private boolean canBuildBitmaps; + 293) +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 294) private boolean indexDisabled; + 295) +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 296) private int depth; + 297) +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 298) private Collection unshallowObjects; + 299) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 300) private PackBitmapIndexBuilder writeBitmaps; + 301) +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 302) private CRC32 crc32; + 303) +53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 304) private ObjectCountCallback callback; + 305) +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 306) private long filterBlobLimit = -1; + 307) +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 308) /** +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 309) * Create writer for specified repository. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 310) *

+10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 311) * Objects for packing are specified in {@link #preparePack(Iterator)} or +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 312) * {@link #preparePack(ProgressMonitor, Set, Set)}. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 313) * +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 314) * @param repo +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 315) * repository where objects are stored. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 316) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 317) public PackWriter(Repository repo) { +515deaf7e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-29 18:12:53 -0400 318) this(repo, repo.newObjectReader()); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 319) } + 320) +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 321) /** +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 322) * Create a writer to load objects from the specified reader. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 323) *

+10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 324) * Objects for packing are specified in {@link #preparePack(Iterator)} or +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 325) * {@link #preparePack(ProgressMonitor, Set, Set)}. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 326) * +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 327) * @param reader +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 328) * reader to read from the repository with. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 329) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 330) public PackWriter(ObjectReader reader) { +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 331) this(new PackConfig(), reader); +515deaf7e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-29 18:12:53 -0400 332) } + 333) +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 334) /** +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 335) * Create writer for specified repository. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 336) *

+10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 337) * Objects for packing are specified in {@link #preparePack(Iterator)} or +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 338) * {@link #preparePack(ProgressMonitor, Set, Set)}. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 339) * +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 340) * @param repo +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 341) * repository where objects are stored. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 342) * @param reader +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 343) * reader to read from the repository with. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 344) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 345) public PackWriter(Repository repo, ObjectReader reader) { +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 346) this(new PackConfig(repo), reader); +515deaf7e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-29 18:12:53 -0400 347) } + 348) +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 349) /** +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 350) * Create writer with a specified configuration. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 351) *

+10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 352) * Objects for packing are specified in {@link #preparePack(Iterator)} or +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 353) * {@link #preparePack(ProgressMonitor, Set, Set)}. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 354) * +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 355) * @param config +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 356) * configuration for the pack writer. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 357) * @param reader +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 358) * reader to read from the repository with. +10412ddfe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-04-24 18:51:02 -0400 359) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 360) public PackWriter(PackConfig config, ObjectReader reader) { +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 361) this(config, reader, null); +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 362) } + 363) +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 364) /** +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 365) * Create writer with a specified configuration. +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 366) *

+302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 367) * Objects for packing are specified in {@link #preparePack(Iterator)} or +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 368) * {@link #preparePack(ProgressMonitor, Set, Set)}. +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 369) * +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 370) * @param config +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 371) * configuration for the pack writer. +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 372) * @param reader +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 373) * reader to read from the repository with. +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 374) * @param statsAccumulator +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 375) * accumulator for statics +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 376) */ +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 377) public PackWriter(PackConfig config, final ObjectReader reader, +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 378) @Nullable PackStatistics.Accumulator statsAccumulator) { +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 379) this.config = config; +515deaf7e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-29 18:12:53 -0400 380) this.reader = reader; +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 381) if (reader instanceof ObjectReuseAsIs) +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 382) reuseSupport = ((ObjectReuseAsIs) reader); +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 383) else +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 384) reuseSupport = null; + 385) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 386) deltaBaseAsOffset = config.isDeltaBaseAsOffset(); +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 387) reuseDeltas = config.isReuseDeltas(); +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 388) reuseValidate = true; // be paranoid by default +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 389) stats = statsAccumulator != null ? statsAccumulator +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 390) : new PackStatistics.Accumulator(); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 391) state = new MutableState(); +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 392) selfRef = new WeakReference<>(this); +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 393) instances.put(selfRef, Boolean.TRUE); +302596cc6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2018-02-12 16:59:42 -0500 394) } + 395) +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 396) /** +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 397) * Set the {@code ObjectCountCallback}. +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 398) *

+061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 399) * It should be set before calling +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 400) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 401) * +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 402) * @param callback +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 403) * the callback to set +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 404) * @return this object for chaining. +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 405) */ +53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 406) public PackWriter setObjectCountCallback(ObjectCountCallback callback) { +53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 407) this.callback = callback; +53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 408) return this; +53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 409) } + 410) +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 411) /** +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 412) * Records the set of shallow commits in the client. +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 413) * +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 414) * @param clientShallowCommits +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 415) * the shallow commits in the client +061d24f6d org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2017-01-24 17:41:24 -0500 416) */ +6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 17:49:47 -0400 417) public void setClientShallowCommits(Set clientShallowCommits) { +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 418) stats.clientShallowCommits = Collections +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 419) .unmodifiableSet(new HashSet<>(clientShallowCommits)); +6a415915c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-15 17:49:47 -0400 420) } + 421) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 422) /** +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 423) * Check whether writer can store delta base as an offset (new style +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 424) * reducing pack size) or should store it as an object id (legacy style, +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 425) * compatible with old readers). +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 426) * +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 427) * Default setting: {@value PackConfig#DEFAULT_DELTA_BASE_AS_OFFSET} +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 428) * +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 429) * @return true if delta base is stored as an offset; false if it is stored +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 430) * as an object id. +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 431) */ +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 432) public boolean isDeltaBaseAsOffset() { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 433) return deltaBaseAsOffset; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 434) } + 435) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 436) /** +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 437) * Set writer delta base format. Delta base can be written as an offset in a +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 438) * pack file (new approach reducing file size) or as an object id (legacy +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 439) * approach, compatible with old readers). +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 440) * +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 441) * Default setting: {@value PackConfig#DEFAULT_DELTA_BASE_AS_OFFSET} +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 442) * +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 443) * @param deltaBaseAsOffset +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 444) * boolean indicating whether delta base can be stored as an +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 445) * offset. +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 446) */ +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 447) public void setDeltaBaseAsOffset(boolean deltaBaseAsOffset) { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 448) this.deltaBaseAsOffset = deltaBaseAsOffset; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 449) } + 450) +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 451) /** +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 452) * Check if the writer will reuse commits that are already stored as deltas. +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 453) * +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 454) * @return true if the writer would reuse commits stored as deltas, assuming +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 455) * delta reuse is already enabled. +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 456) */ +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 457) public boolean isReuseDeltaCommits() { +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 458) return reuseDeltaCommits; +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 459) } + 460) +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 461) /** +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 462) * Set the writer to reuse existing delta versions of commits. +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 463) * +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 464) * @param reuse +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 465) * if true, the writer will reuse any commits stored as deltas. +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 466) * By default the writer does not reuse delta commits. +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 467) */ +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 468) public void setReuseDeltaCommits(boolean reuse) { +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 469) reuseDeltaCommits = reuse; +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 470) } + 471) +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 472) /** +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 473) * Check if the writer validates objects before copying them. +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 474) * +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 475) * @return true if validation is enabled; false if the reader will handle +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 476) * object validation as a side-effect of it consuming the output. +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 477) */ +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 478) public boolean isReuseValidatingObjects() { +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 479) return reuseValidate; +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 480) } + 481) +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 482) /** +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 483) * Enable (or disable) object validation during packing. +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 484) * +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 485) * @param validate +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 486) * if true the pack writer will validate an object before it is +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 487) * put into the output. This additional validation work may be +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 488) * necessary to avoid propagating corruption from one local pack +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 489) * file to another local pack file. +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 490) */ +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 491) public void setReuseValidatingObjects(boolean validate) { +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 492) reuseValidate = validate; +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 493) } + 494) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 495) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 496) * Whether this writer is producing a thin pack. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 497) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 498) * @return true if this writer is producing a thin pack. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 499) */ +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 500) public boolean isThin() { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 501) return thin; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 502) } + 503) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 504) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 505) * Whether writer may pack objects with delta base object not within set of +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 506) * objects to pack +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 507) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 508) * @param packthin +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 509) * a boolean indicating whether writer may pack objects with +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 510) * delta base object not within set of objects to pack, but +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 511) * belonging to party repository (uninteresting/boundary) as +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 512) * determined by set; this kind of pack is used only for +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 513) * transport; true - to produce thin pack, false - otherwise. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 514) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 515) public void setThin(boolean packthin) { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 516) thin = packthin; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 517) } + 518) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 519) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 520) * Whether to reuse cached packs. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 521) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 522) * @return {@code true} to reuse cached packs. If true index creation isn't +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 523) * available. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 524) */ +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 525) public boolean isUseCachedPacks() { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 526) return useCachedPacks; +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 527) } + 528) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 529) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 530) * Whether to use cached packs +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 531) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 532) * @param useCached +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 533) * if set to {@code true} and a cached pack is present, it will +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 534) * be appended onto the end of a thin-pack, reducing the amount +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 535) * of working set space and CPU used by PackWriter. Enabling this +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 536) * feature prevents PackWriter from creating an index for the +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 537) * newly created pack, so its only suitable for writing to a +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 538) * network client, where the client will make the index. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 539) */ +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 540) public void setUseCachedPacks(boolean useCached) { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 541) useCachedPacks = useCached; +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 542) } + 543) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 544) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 545) * Whether to use bitmaps +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 546) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 547) * @return {@code true} to use bitmaps for ObjectWalks, if available. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 548) */ +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 549) public boolean isUseBitmaps() { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 550) return useBitmaps; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 551) } + 552) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 553) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 554) * Whether to use bitmaps +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 555) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 556) * @param useBitmaps +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 557) * if set to true, bitmaps will be used when preparing a pack. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 558) */ +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 559) public void setUseBitmaps(boolean useBitmaps) { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 560) this.useBitmaps = useBitmaps; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 561) } + 562) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 563) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 564) * Whether the index file cannot be created by this PackWriter. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 565) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 566) * @return {@code true} if the index file cannot be created by this +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 567) * PackWriter. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 568) */ +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 569) public boolean isIndexDisabled() { +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 570) return indexDisabled || !cachedPacks.isEmpty(); +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 571) } + 572) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 573) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 574) * Whether to disable creation of the index file. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 575) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 576) * @param noIndex +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 577) * {@code true} to disable creation of the index file. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 578) */ +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 579) public void setIndexDisabled(boolean noIndex) { +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 580) this.indexDisabled = noIndex; +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 581) } + 582) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 583) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 584) * Whether to ignore missing uninteresting objects +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 585) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 586) * @return {@code true} to ignore objects that are uninteresting and also +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 587) * not found on local disk; false to throw a +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 588) * {@link org.eclipse.jgit.errors.MissingObjectException} out of +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 589) * {@link #preparePack(ProgressMonitor, Set, Set)} if an +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 590) * uninteresting object is not in the source repository. By default, +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 591) * true, permitting gracefully ignoring of uninteresting objects. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 592) */ +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 593) public boolean isIgnoreMissingUninteresting() { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 594) return ignoreMissingUninteresting; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 595) } + 596) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 597) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 598) * Whether writer should ignore non existing uninteresting objects +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 599) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 600) * @param ignore +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 601) * {@code true} if writer should ignore non existing +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 602) * uninteresting objects during construction set of objects to +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 603) * pack; false otherwise - non existing uninteresting objects may +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 604) * cause {@link org.eclipse.jgit.errors.MissingObjectException} +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 605) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 606) public void setIgnoreMissingUninteresting(boolean ignore) { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 607) ignoreMissingUninteresting = ignore; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 608) } + 609) +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 610) /** +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 611) * Set the tag targets that should be hoisted earlier during packing. +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 612) *

+8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 613) * Callers may put objects into this set before invoking any of the +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 614) * preparePack methods to influence where an annotated tag's target is +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 615) * stored within the resulting pack. Typically these will be clustered +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 616) * together, and hoisted earlier in the file even if they are ancient +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 617) * revisions, allowing readers to find tag targets with better locality. +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 618) * +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 619) * @param objects +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 620) * objects that annotated tags point at. +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 621) */ +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 622) public void setTagTargets(Set objects) { +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 623) tagTargets = objects; +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 624) } + 625) +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 626) /** +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 627) * Configure this pack for a shallow clone. +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 628) * +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 629) * @param depth +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 630) * maximum depth of history to return. 1 means return only the +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 631) * "wants". +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 632) * @param unshallow +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 633) * objects which used to be shallow on the client, but are being +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 634) * extended as part of this fetch +e426aa8b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 20:27:30 -0400 635) */ +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 636) public void setShallowPack(int depth, +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 637) Collection unshallow) { +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 638) this.shallowPack = true; +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 639) this.depth = depth; +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 640) this.unshallowObjects = unshallow; +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 641) } + 642) +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 643) /** +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 644) * @param bytes exclude blobs of size greater than this +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 645) * @since 5.0 +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 646) */ +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 647) public void setFilterBlobLimit(long bytes) { +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 648) filterBlobLimit = bytes; +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 649) } + 650) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 651) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 652) * Returns objects number in a pack file that was created by this writer. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 653) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 654) * @return number of objects in pack. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 655) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 656) * a cached pack cannot supply its object count. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 657) */ +7a9bf1e2e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:52 -0400 658) public long getObjectCount() throws IOException { +65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 659) if (stats.totalObjects == 0) { +65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 660) long objCnt = 0; + 661) +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 662) objCnt += objectsLists[OBJ_COMMIT].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 663) objCnt += objectsLists[OBJ_TREE].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 664) objCnt += objectsLists[OBJ_BLOB].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 665) objCnt += objectsLists[OBJ_TAG].size(); + 666) +65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 667) for (CachedPack pack : cachedPacks) +65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 668) objCnt += pack.getObjectCount(); +65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 669) return objCnt; +65f9a6e58 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:51 -0400 670) } +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 671) return stats.totalObjects; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 672) } + 673) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 674) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 675) * Returns the object ids in the pack file that was created by this writer. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 676) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 677) * This method can only be invoked after +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 678) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)} has +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 679) * been invoked and completed successfully. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 680) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 681) * @return set of objects in pack. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 682) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 683) * a cached pack cannot supply its object ids. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 684) */ +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 685) public ObjectIdOwnerMap getObjectSet() +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 686) throws IOException { +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 687) if (!cachedPacks.isEmpty()) +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 688) throw new IOException( +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 689) JGitText.get().cachedPacksPreventsListingObjects); + 690) +f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 691) if (writeBitmaps != null) { +f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 692) return writeBitmaps.getObjectSet(); +f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 693) } + 694) +f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 695) ObjectIdOwnerMap r = new ObjectIdOwnerMap<>(); +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 696) for (BlockList objList : objectsLists) { +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 697) if (objList != null) { +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 698) for (ObjectToPack otp : objList) +f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 699) r.add(new ObjectIdOwnerMap.Entry(otp) { +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 700) // A new entry that copies the ObjectId +f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 701) }); +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 702) } +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 703) } +f9bd6c123 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-14 14:13:34 -0400 704) return r; +7fbd6588b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-22 18:25:15 -0500 705) } + 706) +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 707) /** +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 708) * Add a pack index whose contents should be excluded from the result. +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 709) * +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 710) * @param idx +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 711) * objects in this index will not be in the output pack. +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 712) */ +7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 713) public void excludeObjects(ObjectIdSet idx) { +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 714) if (excludeInPacks == null) { +7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 715) excludeInPacks = new ObjectIdSet[] { idx }; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 716) excludeInPackLast = idx; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 717) } else { +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 718) int cnt = excludeInPacks.length; +7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 719) ObjectIdSet[] newList = new ObjectIdSet[cnt + 1]; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 720) System.arraycopy(excludeInPacks, 0, newList, 0, cnt); +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 721) newList[cnt] = idx; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 722) excludeInPacks = newList; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 723) } +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 724) } + 725) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 726) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 727) * Prepare the list of objects to be written to the pack stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 728) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 729) * Iterator exactly determines which objects are included in a pack +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 730) * and order they appear in pack (except that objects order by type is not +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 731) * needed at input). This order should conform general rules of ordering +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 732) * objects in git - by recency and path (type and delta-base first is +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 733) * internally secured) and responsibility for guaranteeing this order is on +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 734) * a caller side. Iterator must return each id of object to write exactly +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 735) * once. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 736) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 737) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 738) * @param objectsSource +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 739) * iterator of object to store in a pack; order of objects within +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 740) * each type is important, ordering by type is not needed; +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 741) * allowed types for objects are +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 742) * {@link org.eclipse.jgit.lib.Constants#OBJ_COMMIT}, +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 743) * {@link org.eclipse.jgit.lib.Constants#OBJ_TREE}, +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 744) * {@link org.eclipse.jgit.lib.Constants#OBJ_BLOB} and +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 745) * {@link org.eclipse.jgit.lib.Constants#OBJ_TAG}; objects +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 746) * returned by iterator may be later reused by caller as object +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 747) * id and type are internally copied in each iteration. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 748) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 749) * when some I/O problem occur during reading objects. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 750) */ +4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 751) public void preparePack(@NonNull Iterator objectsSource) +4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 752) throws IOException { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 753) while (objectsSource.hasNext()) { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 754) addObject(objectsSource.next()); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 755) } +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 756) } + 757) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 758) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 759) * Prepare the list of objects to be written to the pack stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 760) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 761) * Basing on these 2 sets, another set of objects to put in a pack file is +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 762) * created: this set consists of all objects reachable (ancestors) from +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 763) * interesting objects, except uninteresting objects and their ancestors. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 764) * This method uses class {@link org.eclipse.jgit.revwalk.ObjectWalk} +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 765) * extensively to find out that appropriate set of output objects and their +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 766) * optimal order in output pack. Order is consistent with general git +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 767) * in-pack rules: sort by object type, recency, path and delta-base first. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 768) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 769) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 770) * @param countingMonitor +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 771) * progress during object enumeration. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 772) * @param want +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 773) * collection of objects to be marked as interesting (start +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 774) * points of graph traversal). Must not be {@code null}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 775) * @param have +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 776) * collection of objects to be marked as uninteresting (end +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 777) * points of graph traversal). Pass {@link #NONE} if all objects +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 778) * reachable from {@code want} are desired, such as when serving +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 779) * a clone. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 780) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 781) * when some I/O problem occur during reading objects. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 782) */ +4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 783) public void preparePack(ProgressMonitor countingMonitor, +4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 784) @NonNull Set want, +4e650c0d7 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2016-01-12 19:30:32 -0500 785) @NonNull Set have) throws IOException { +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 786) preparePack(countingMonitor, want, have, NONE, NONE); +74333e63b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-16 15:18:39 -0400 787) } + 788) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 789) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 790) * Prepare the list of objects to be written to the pack stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 791) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 792) * Like {@link #preparePack(ProgressMonitor, Set, Set)} but also allows +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 793) * specifying commits that should not be walked past ("shallow" commits). +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 794) * The caller is responsible for filtering out commits that should not be +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 795) * shallow any more ("unshallow" commits as in {@link #setShallowPack}) from +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 796) * the shallow set. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 797) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 798) * @param countingMonitor +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 799) * progress during object enumeration. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 800) * @param want +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 801) * objects of interest, ancestors of which will be included in +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 802) * the pack. Must not be {@code null}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 803) * @param have +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 804) * objects whose ancestors (up to and including {@code shallow} +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 805) * commits) do not need to be included in the pack because they +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 806) * are already available from elsewhere. Must not be +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 807) * {@code null}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 808) * @param shallow +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 809) * commits indicating the boundary of the history marked with +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 810) * {@code have}. Shallow commits have parents but those parents +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 811) * are considered not to be already available. Parents of +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 812) * {@code shallow} commits and earlier generations will be +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 813) * included in the pack if requested by {@code want}. Must not be +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 814) * {@code null}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 815) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 816) * an I/O problem occurred while reading objects. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 817) */ +3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 818) public void preparePack(ProgressMonitor countingMonitor, +3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 819) @NonNull Set want, +3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 820) @NonNull Set have, +3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 821) @NonNull Set shallow) throws IOException { +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 822) preparePack(countingMonitor, want, have, shallow, NONE); +3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 823) } + 824) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 825) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 826) * Prepare the list of objects to be written to the pack stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 827) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 828) * Like {@link #preparePack(ProgressMonitor, Set, Set)} but also allows +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 829) * specifying commits that should not be walked past ("shallow" commits). +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 830) * The caller is responsible for filtering out commits that should not be +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 831) * shallow any more ("unshallow" commits as in {@link #setShallowPack}) from +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 832) * the shallow set. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 833) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 834) * @param countingMonitor +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 835) * progress during object enumeration. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 836) * @param want +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 837) * objects of interest, ancestors of which will be included in +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 838) * the pack. Must not be {@code null}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 839) * @param have +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 840) * objects whose ancestors (up to and including {@code shallow} +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 841) * commits) do not need to be included in the pack because they +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 842) * are already available from elsewhere. Must not be +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 843) * {@code null}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 844) * @param shallow +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 845) * commits indicating the boundary of the history marked with +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 846) * {@code have}. Shallow commits have parents but those parents +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 847) * are considered not to be already available. Parents of +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 848) * {@code shallow} commits and earlier generations will be +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 849) * included in the pack if requested by {@code want}. Must not be +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 850) * {@code null}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 851) * @param noBitmaps +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 852) * collection of objects to be excluded from bitmap commit +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 853) * selection. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 854) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 855) * an I/O problem occurred while reading objects. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 856) */ +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 857) public void preparePack(ProgressMonitor countingMonitor, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 858) @NonNull Set want, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 859) @NonNull Set have, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 860) @NonNull Set shallow, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 861) @NonNull Set noBitmaps) throws IOException { +08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 862) try (ObjectWalk ow = getObjectWalk()) { +3b0b7677f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Nieder 2016-08-08 16:50:57 -0400 863) ow.assumeShallow(shallow); +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 864) preparePack(countingMonitor, ow, want, have, noBitmaps); +08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 865) } +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 866) } + 867) +08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 868) private ObjectWalk getObjectWalk() { +08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 869) return shallowPack ? new DepthWalk.ObjectWalk(reader, depth - 1) +08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 870) : new ObjectWalk(reader); +08480c948 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-02-06 18:50:09 -0500 871) } + 872) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 873) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 874) * Prepare the list of objects to be written to the pack stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 875) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 876) * Basing on these 2 sets, another set of objects to put in a pack file is +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 877) * created: this set consists of all objects reachable (ancestors) from +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 878) * interesting objects, except uninteresting objects and their ancestors. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 879) * This method uses class {@link org.eclipse.jgit.revwalk.ObjectWalk} +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 880) * extensively to find out that appropriate set of output objects and their +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 881) * optimal order in output pack. Order is consistent with general git +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 882) * in-pack rules: sort by object type, recency, path and delta-base first. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 883) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 884) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 885) * @param countingMonitor +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 886) * progress during object enumeration. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 887) * @param walk +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 888) * ObjectWalk to perform enumeration. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 889) * @param interestingObjects +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 890) * collection of objects to be marked as interesting (start +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 891) * points of graph traversal). Must not be {@code null}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 892) * @param uninterestingObjects +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 893) * collection of objects to be marked as uninteresting (end +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 894) * points of graph traversal). Pass {@link #NONE} if all objects +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 895) * reachable from {@code want} are desired, such as when serving +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 896) * a clone. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 897) * @param noBitmaps +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 898) * collection of objects to be excluded from bitmap commit +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 899) * selection. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 900) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 901) * when some I/O problem occur during reading objects. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 902) */ +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 903) public void preparePack(ProgressMonitor countingMonitor, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 904) @NonNull ObjectWalk walk, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 905) @NonNull Set interestingObjects, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 906) @NonNull Set uninterestingObjects, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 907) @NonNull Set noBitmaps) +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 908) throws IOException { +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 909) if (countingMonitor == null) +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 910) countingMonitor = NullProgressMonitor.INSTANCE; +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 911) if (shallowPack && !(walk instanceof DepthWalk.ObjectWalk)) +d385a7a5e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 18:37:36 -0400 912) throw new IllegalArgumentException( +d385a7a5e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 18:37:36 -0400 913) JGitText.get().shallowPacksRequireDepthWalk); +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 914) findObjectsToPack(countingMonitor, walk, interestingObjects, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 915) uninterestingObjects, noBitmaps); +74333e63b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-16 15:18:39 -0400 916) } + 917) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 918) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 919) * Determine if the pack file will contain the requested object. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 920) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 921) * @param id +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 922) * the object to test the existence of. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 923) * @return true if the object will appear in the output pack file. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 924) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 925) * a cached pack cannot be examined. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 926) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 927) public boolean willInclude(AnyObjectId id) throws IOException { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 928) ObjectToPack obj = objectsMap.get(id); +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 929) return obj != null && !obj.isEdge(); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 930) } + 931) +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 932) /** +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 933) * Lookup the ObjectToPack object for a given ObjectId. +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 934) * +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 935) * @param id +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 936) * the object to find in the pack. +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 937) * @return the object we are packing, or null. +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 938) */ +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 939) public ObjectToPack get(AnyObjectId id) { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 940) ObjectToPack obj = objectsMap.get(id); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 941) return obj != null && !obj.isEdge() ? obj : null; +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 942) } + 943) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 944) /** +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 945) * Computes SHA-1 of lexicographically sorted objects ids written in this +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 946) * pack, as used to name a pack file in repository. +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 947) * +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 948) * @return ObjectId representing SHA-1 name of a pack that was created. +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 949) */ +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 950) public ObjectId computeName() { +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 951) final byte[] buf = new byte[OBJECT_ID_LENGTH]; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 952) final MessageDigest md = Constants.newMessageDigest(); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 953) for (ObjectToPack otp : sortByName()) { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 954) otp.copyRawTo(buf, 0); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 955) md.update(buf, 0, OBJECT_ID_LENGTH); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 956) } +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 957) return ObjectId.fromRaw(md.digest()); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 958) } + 959) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 960) /** +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 961) * Returns the index format version that will be written. +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 962) *

+dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 963) * This method can only be invoked after +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 964) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)} has +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 965) * been invoked and completed successfully. +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 966) * +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 967) * @return the index format version. +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 968) */ +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 969) public int getIndexVersion() { +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 970) int indexVersion = config.getIndexVersion(); +616bc74cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:00:46 -0400 971) if (indexVersion <= 0) { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 972) for (BlockList objs : objectsLists) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 973) indexVersion = Math.max(indexVersion, +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 974) PackIndexWriter.oldestPossibleFormat(objs)); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 975) } +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 976) return indexVersion; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 977) } + 978) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 979) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 980) * Create an index file to match the pack file just written. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 981) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 982) * Called after +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 983) * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 984) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 985) * Writing an index is only required for local pack storage. Packs sent on +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 986) * the network do not need to create an index. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 987) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 988) * @param indexStream +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 989) * output for the index data. Caller is responsible for closing +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 990) * this stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 991) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 992) * the index data could not be written to the supplied stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 993) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 994) public void writeIndex(OutputStream indexStream) throws IOException { +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 995) if (isIndexDisabled()) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 996) throw new IOException(JGitText.get().cachedPacksPreventsIndexCreation); + 997) +1b6a549ff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-09-14 18:34:55 -0400 998) long writeStart = System.currentTimeMillis(); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 999) final PackIndexWriter iw = PackIndexWriter.createVersion( +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1000) indexStream, getIndexVersion()); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1001) iw.write(sortByName(), packcsum); +1b6a549ff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-09-14 18:34:55 -0400 1002) stats.timeWriting += System.currentTimeMillis() - writeStart; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1003) } + 1004) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1005) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1006) * Create a bitmap index file to match the pack file just written. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1007) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1008) * Called after {@link #prepareBitmapIndex(ProgressMonitor)}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1009) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1010) * @param bitmapIndexStream +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1011) * output for the bitmap index data. Caller is responsible for +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1012) * closing this stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1013) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1014) * the index data could not be written to the supplied stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1015) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 1016) public void writeBitmapIndex(OutputStream bitmapIndexStream) +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 1017) throws IOException { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1018) if (writeBitmaps == null) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1019) throw new IOException(JGitText.get().bitmapsMustBePrepared); + 1020) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1021) long writeStart = System.currentTimeMillis(); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1022) final PackBitmapIndexWriterV1 iw = new PackBitmapIndexWriterV1(bitmapIndexStream); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1023) iw.write(writeBitmaps, packcsum); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1024) stats.timeWriting += System.currentTimeMillis() - writeStart; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1025) } + 1026) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1027) private List sortByName() { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1028) if (sortedByName == null) { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1029) int cnt = 0; +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1030) cnt += objectsLists[OBJ_COMMIT].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1031) cnt += objectsLists[OBJ_TREE].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1032) cnt += objectsLists[OBJ_BLOB].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1033) cnt += objectsLists[OBJ_TAG].size(); + 1034) +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1035) sortedByName = new BlockList<>(cnt); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1036) sortedByName.addAll(objectsLists[OBJ_COMMIT]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1037) sortedByName.addAll(objectsLists[OBJ_TREE]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1038) sortedByName.addAll(objectsLists[OBJ_BLOB]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1039) sortedByName.addAll(objectsLists[OBJ_TAG]); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1040) Collections.sort(sortedByName); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1041) } +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1042) return sortedByName; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1043) } + 1044) +1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1045) private void beginPhase(PackingPhase phase, ProgressMonitor monitor, +1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1046) long cnt) { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1047) state.phase = phase; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1048) String task; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1049) switch (phase) { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1050) case COUNTING: +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1051) task = JGitText.get().countingObjects; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1052) break; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1053) case GETTING_SIZES: +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1054) task = JGitText.get().searchForSizes; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1055) break; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1056) case FINDING_SOURCES: +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1057) task = JGitText.get().searchForReuse; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1058) break; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1059) case COMPRESSING: +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1060) task = JGitText.get().compressingObjects; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1061) break; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1062) case WRITING: +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1063) task = JGitText.get().writingObjects; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1064) break; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1065) case BUILDING_BITMAPS: +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1066) task = JGitText.get().buildingBitmaps; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1067) break; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1068) default: +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1069) throw new IllegalArgumentException( +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1070) MessageFormat.format(JGitText.get().illegalPackingPhase, phase)); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1071) } +1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1072) monitor.beginTask(task, (int) cnt); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1073) } + 1074) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1075) private void endPhase(ProgressMonitor monitor) { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1076) monitor.endTask(); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1077) } + 1078) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1079) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1080) * Write the prepared pack to the supplied stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1081) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1082) * Called after +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1083) * {@link #preparePack(ProgressMonitor, ObjectWalk, Set, Set, Set)} or +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1084) * {@link #preparePack(ProgressMonitor, Set, Set)}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1085) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1086) * Performs delta search if enabled and writes the pack stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1087) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1088) * All reused objects data checksum (Adler32/CRC32) is computed and +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1089) * validated against existing checksum. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1090) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1091) * @param compressMonitor +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1092) * progress monitor to report object compression work. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1093) * @param writeMonitor +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1094) * progress monitor to report the number of objects written. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1095) * @param packStream +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1096) * output stream of pack data. The stream should be buffered by +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1097) * the caller. The caller is responsible for closing the stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1098) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1099) * an error occurred reading a local object's data to include in +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1100) * the pack, or writing compressed object data to the output +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1101) * stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1102) * @throws WriteAbortedException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1103) * the write operation is aborted by +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1104) * {@link org.eclipse.jgit.transport.ObjectCountCallback} . +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1105) */ +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1106) public void writePack(ProgressMonitor compressMonitor, +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1107) ProgressMonitor writeMonitor, OutputStream packStream) +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1108) throws IOException { +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1109) if (compressMonitor == null) +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1110) compressMonitor = NullProgressMonitor.INSTANCE; +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1111) if (writeMonitor == null) +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1112) writeMonitor = NullProgressMonitor.INSTANCE; + 1113) +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1114) excludeInPacks = null; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1115) excludeInPackLast = null; + 1116) +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1117) boolean needSearchForReuse = reuseSupport != null && ( +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1118) reuseDeltas +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1119) || config.isReuseObjects() +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1120) || !cachedPacks.isEmpty()); + 1121) +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1122) if (compressMonitor instanceof BatchingProgressMonitor) { +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1123) long delay = 1000; +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1124) if (needSearchForReuse && config.isDeltaCompress()) +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1125) delay = 500; +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1126) ((BatchingProgressMonitor) compressMonitor).setDelayStart( +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1127) delay, +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1128) TimeUnit.MILLISECONDS); +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1129) } + 1130) +68cc21b60 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-07-28 13:22:50 -0400 1131) if (needSearchForReuse) +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1132) searchForReuse(compressMonitor); +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1133) if (config.isDeltaCompress()) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1134) searchForDeltas(compressMonitor); + 1135) +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1136) crc32 = new CRC32(); +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1137) final PackOutputStream out = new PackOutputStream( +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1138) writeMonitor, +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1139) isIndexDisabled() +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1140) ? packStream +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1141) : new CheckedOutputStream(packStream, crc32), +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1142) this); + 1143) +7a9bf1e2e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-14 11:01:52 -0400 1144) long objCnt = getObjectCount(); +71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 1145) stats.totalObjects = objCnt; +53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 1146) if (callback != null) +53be446f6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Yuxuan 'fishy' Wang 2015-06-09 17:11:13 -0400 1147) callback.setObjectCount(objCnt); +1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1148) beginPhase(PackingPhase.WRITING, writeMonitor, objCnt); +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1149) long writeStart = System.currentTimeMillis(); +bc90ce778 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2014-09-04 15:45:18 -0400 1150) try { +21f76c2a6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1151) out.writeFileHeader(PACK_VERSION_GENERATED, objCnt); +cc6210619 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1152) out.flush(); + 1153) +28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1154) writeObjects(out); +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1155) if (!edgeObjects.isEmpty() || !cachedPacks.isEmpty()) { +d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 1156) for (PackStatistics.ObjectType.Accumulator typeStat : stats.objectTypes) { +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1157) if (typeStat == null) +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1158) continue; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1159) stats.thinPackBytes += typeStat.bytes; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1160) } +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1161) } + 1162) +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1163) stats.reusedPacks = Collections.unmodifiableList(cachedPacks); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1164) for (CachedPack pack : cachedPacks) { +388ba7e00 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1165) long deltaCnt = pack.getDeltaCount(); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1166) stats.reusedObjects += pack.getObjectCount(); +388ba7e00 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1167) stats.reusedDeltas += deltaCnt; +388ba7e00 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1168) stats.totalDeltas += deltaCnt; +6e5c71b35 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-04-24 14:31:22 -0400 1169) reuseSupport.copyPackAsIs(out, pack); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1170) } +f288c27e4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1171) writeChecksum(out); +cc6210619 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1172) out.flush(); +bc90ce778 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2014-09-04 15:45:18 -0400 1173) } finally { +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1174) stats.timeWriting = System.currentTimeMillis() - writeStart; +1b6a549ff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-09-14 18:34:55 -0400 1175) stats.depth = depth; + 1176) +d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 1177) for (PackStatistics.ObjectType.Accumulator typeStat : stats.objectTypes) { +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1178) if (typeStat == null) +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1179) continue; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1180) typeStat.cntDeltas += typeStat.reusedDeltas; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1181) stats.reusedObjects += typeStat.reusedObjects; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1182) stats.reusedDeltas += typeStat.reusedDeltas; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1183) stats.totalDeltas += typeStat.cntDeltas; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1184) } +bc90ce778 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2014-09-04 15:45:18 -0400 1185) } + 1186) +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1187) stats.totalBytes = out.length(); +0e73d3950 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-05-20 18:01:36 -0400 1188) reader.close(); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1189) endPhase(writeMonitor); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1190) } + 1191) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1192) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1193) * Get statistics of what this PackWriter did in order to create the final +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1194) * pack stream. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1195) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1196) * @return description of what this PackWriter did in order to create the +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1197) * final pack stream. This should only be invoked after the calls to +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1198) * create the pack/index/bitmap have completed. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1199) */ +d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 1200) public PackStatistics getStatistics() { +d9bbb04c3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-12 16:56:16 -0400 1201) return new PackStatistics(stats); +71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 1202) } + 1203) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1204) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1205) * Get snapshot of the current state of this PackWriter. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1206) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1207) * @return snapshot of the current state of this PackWriter. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1208) */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1209) public State getState() { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1210) return state.snapshot(); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1211) } + 1212) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1213) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1214) * {@inheritDoc} +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1215) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1216) * Release all resources used by this writer. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 1217) */ +77030a5e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-02-09 08:11:50 -0500 1218) @Override +77030a5e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-02-09 08:11:50 -0500 1219) public void close() { +77030a5e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-02-09 08:11:50 -0500 1220) reader.close(); +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1221) if (myDeflater != null) { +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1222) myDeflater.end(); +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1223) myDeflater = null; +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1224) } +2b584b921 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1225) instances.remove(selfRef); +77030a5e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2015-02-09 08:11:50 -0500 1226) } + 1227) +b85af0632 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1228) private void searchForReuse(ProgressMonitor monitor) throws IOException { +1421106d7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1229) long cnt = 0; +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1230) cnt += objectsLists[OBJ_COMMIT].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1231) cnt += objectsLists[OBJ_TREE].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1232) cnt += objectsLists[OBJ_BLOB].size(); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1233) cnt += objectsLists[OBJ_TAG].size(); + 1234) +7505b9354 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-23 14:56:19 -0500 1235) long start = System.currentTimeMillis(); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1236) beginPhase(PackingPhase.FINDING_SOURCES, monitor, cnt); +36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1237) if (cnt <= 4096) { +36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1238) // For small object counts, do everything as one list. +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1239) BlockList tmp = new BlockList<>((int) cnt); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1240) tmp.addAll(objectsLists[OBJ_TAG]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1241) tmp.addAll(objectsLists[OBJ_COMMIT]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1242) tmp.addAll(objectsLists[OBJ_TREE]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1243) tmp.addAll(objectsLists[OBJ_BLOB]); +36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1244) searchForReuse(monitor, tmp); +36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1245) if (pruneCurrentObjectList) { +36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1246) // If the list was pruned, we need to re-prune the main lists. +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1247) pruneEdgesFromObjectList(objectsLists[OBJ_COMMIT]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1248) pruneEdgesFromObjectList(objectsLists[OBJ_TREE]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1249) pruneEdgesFromObjectList(objectsLists[OBJ_BLOB]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1250) pruneEdgesFromObjectList(objectsLists[OBJ_TAG]); +36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1251) } +36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1252) } else { +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1253) searchForReuse(monitor, objectsLists[OBJ_TAG]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1254) searchForReuse(monitor, objectsLists[OBJ_COMMIT]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1255) searchForReuse(monitor, objectsLists[OBJ_TREE]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1256) searchForReuse(monitor, objectsLists[OBJ_BLOB]); +36a38adf7 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1257) } +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1258) endPhase(monitor); +7505b9354 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-23 14:56:19 -0500 1259) stats.timeSearchingForReuse = System.currentTimeMillis() - start; + 1260) +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1261) if (config.isReuseDeltas() && config.getCutDeltaChains()) { +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1262) cutDeltaChains(objectsLists[OBJ_TREE]); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1263) cutDeltaChains(objectsLists[OBJ_BLOB]); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1264) } +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1265) } + 1266) +0be24ebf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1267) private void searchForReuse(ProgressMonitor monitor, List list) +0be24ebf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1268) throws IOException, MissingObjectException { +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1269) pruneCurrentObjectList = false; +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1270) reuseSupport.selectObjectRepresentation(this, monitor, list); +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1271) if (pruneCurrentObjectList) +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1272) pruneEdgesFromObjectList(list); +0be24ebf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1273) } + 1274) +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1275) private void cutDeltaChains(BlockList list) +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1276) throws IOException { +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1277) int max = config.getMaxDeltaDepth(); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1278) for (int idx = list.size() - 1; idx >= 0; idx--) { +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1279) int d = 0; +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1280) ObjectToPack b = list.get(idx).getDeltaBase(); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1281) while (b != null) { +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1282) if (d < b.getChainLength()) +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1283) break; +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1284) b.setChainLength(++d); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1285) if (d >= max && b.isDeltaRepresentation()) { +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1286) reselectNonDelta(b); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1287) break; +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1288) } +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1289) b = b.getDeltaBase(); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1290) } +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1291) } +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1292) if (config.isDeltaCompress()) { +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1293) for (ObjectToPack otp : list) +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1294) otp.clearChainLength(); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1295) } +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1296) } + 1297) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1298) private void searchForDeltas(ProgressMonitor monitor) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1299) throws MissingObjectException, IncorrectObjectTypeException, +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1300) IOException { +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1301) // Commits and annotated tags tend to have too many differences to +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1302) // really benefit from delta compression. Consequently just don't +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1303) // bother examining those types here. +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1304) // +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1305) ObjectToPack[] list = new ObjectToPack[ +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1306) objectsLists[OBJ_TREE].size() +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1307) + objectsLists[OBJ_BLOB].size() +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1308) + edgeObjects.size()]; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1309) int cnt = 0; +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1310) cnt = findObjectsNeedingDelta(list, cnt, OBJ_TREE); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1311) cnt = findObjectsNeedingDelta(list, cnt, OBJ_BLOB); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1312) if (cnt == 0) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1313) return; +37a10e300 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 09:55:43 -0500 1314) int nonEdgeCnt = cnt; + 1315) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1316) // Queue up any edge objects that we might delta against. We won't +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1317) // be sending these as we assume the other side has them, but we need +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1318) // them in the search phase below. +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1319) // +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1320) for (ObjectToPack eo : edgeObjects) { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1321) eo.setWeight(0); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1322) list[cnt++] = eo; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1323) } + 1324) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1325) // Compute the sizes of the objects so we can do a proper sort. +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1326) // We let the reader skip missing objects if it chooses. For +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1327) // some readers this can be a huge win. We detect missing objects +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1328) // by having set the weights above to 0 and allowing the delta +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1329) // search code to discover the missing object and skip over it, or +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1330) // abort with an exception if we actually had to have it. +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1331) // +7505b9354 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-23 14:56:19 -0500 1332) final long sizingStart = System.currentTimeMillis(); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1333) beginPhase(PackingPhase.GETTING_SIZES, monitor, cnt); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1334) AsyncObjectSizeQueue sizeQueue = reader.getObjectSize( +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1335) Arrays. asList(list).subList(0, cnt), false); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1336) try { +93a27ce72 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 14:25:57 -0400 1337) final long limit = Math.min( +93a27ce72 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 14:25:57 -0400 1338) config.getBigFileThreshold(), +93a27ce72 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 14:25:57 -0400 1339) Integer.MAX_VALUE); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1340) for (;;) { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1341) try { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1342) if (!sizeQueue.next()) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1343) break; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1344) } catch (MissingObjectException notFound) { +29997ab08 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:51 -0500 1345) monitor.update(1); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1346) if (ignoreMissingUninteresting) { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1347) ObjectToPack otp = sizeQueue.getCurrent(); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1348) if (otp != null && otp.isEdge()) { +594d4ceb1 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 13:56:42 -0400 1349) otp.setDoNotDelta(); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1350) continue; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1351) } + 1352) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1353) otp = objectsMap.get(notFound.getObjectId()); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1354) if (otp != null && otp.isEdge()) { +594d4ceb1 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 13:56:42 -0400 1355) otp.setDoNotDelta(); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1356) continue; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1357) } +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1358) } +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1359) throw notFound; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1360) } + 1361) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1362) ObjectToPack otp = sizeQueue.getCurrent(); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1363) if (otp == null) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1364) otp = objectsMap.get(sizeQueue.getObjectId()); + 1365) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1366) long sz = sizeQueue.getSize(); +93a27ce72 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 14:25:57 -0400 1367) if (DeltaIndex.BLKSZ < sz && sz < limit) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1368) otp.setWeight((int) sz); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1369) else +594d4ceb1 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-04 13:56:42 -0400 1370) otp.setDoNotDelta(); // too small, or too big +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1371) monitor.update(1); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1372) } +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1373) } finally { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1374) sizeQueue.release(); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1375) } +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1376) endPhase(monitor); +7505b9354 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-23 14:56:19 -0500 1377) stats.timeSearchingForSizes = System.currentTimeMillis() - sizingStart; + 1378) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1379) // Sort the objects by path hash so like files are near each other, +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1380) // and then by size descending so that bigger files are first. This +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1381) // applies "Linus' Law" which states that newer files tend to be the +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1382) // bigger ones, because source files grow and hardly ever shrink. +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1383) // +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1384) Arrays.sort(list, 0, cnt, new Comparator() { +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1385) @Override +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1386) public int compare(ObjectToPack a, ObjectToPack b) { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1387) int cmp = (a.isDoNotDelta() ? 1 : 0) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1388) - (b.isDoNotDelta() ? 1 : 0); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1389) if (cmp != 0) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1390) return cmp; + 1391) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1392) cmp = a.getType() - b.getType(); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1393) if (cmp != 0) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1394) return cmp; + 1395) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1396) cmp = (a.getPathHash() >>> 1) - (b.getPathHash() >>> 1); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1397) if (cmp != 0) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1398) return cmp; + 1399) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1400) cmp = (a.getPathHash() & 1) - (b.getPathHash() & 1); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1401) if (cmp != 0) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1402) return cmp; + 1403) +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1404) cmp = (a.isEdge() ? 0 : 1) - (b.isEdge() ? 0 : 1); +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1405) if (cmp != 0) +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1406) return cmp; + 1407) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1408) return b.getWeight() - a.getWeight(); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1409) } +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1410) }); + 1411) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1412) // Above we stored the objects we cannot delta onto the end. +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1413) // Remove them from the list so we don't waste time on them. +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1414) while (0 < cnt && list[cnt - 1].isDoNotDelta()) { +37a10e300 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 09:55:43 -0500 1415) if (!list[cnt - 1].isEdge()) +37a10e300 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 09:55:43 -0500 1416) nonEdgeCnt--; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1417) cnt--; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1418) } +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1419) if (cnt == 0) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1420) return; + 1421) +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1422) final long searchStart = System.currentTimeMillis(); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1423) searchForDeltas(monitor, list, cnt); +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1424) stats.deltaSearchNonEdgeObjects = nonEdgeCnt; +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1425) stats.timeCompressing = System.currentTimeMillis() - searchStart; + 1426) +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1427) for (int i = 0; i < cnt; i++) +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1428) if (!list[i].isEdge() && list[i].isDeltaRepresentation()) +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1429) stats.deltasFound++; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1430) } + 1431) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1432) private int findObjectsNeedingDelta(ObjectToPack[] list, int cnt, int type) { +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1433) for (ObjectToPack otp : objectsLists[type]) { +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1434) if (otp.isDoNotDelta()) // delta is disabled for this path +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1435) continue; +2610eaf38 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-13 20:01:29 -0400 1436) if (otp.isDeltaRepresentation()) // already reusing a delta +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1437) continue; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1438) otp.setWeight(0); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1439) list[cnt++] = otp; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1440) } +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1441) return cnt; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1442) } + 1443) +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1444) private void reselectNonDelta(ObjectToPack otp) throws IOException { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1445) otp.clearDeltaBase(); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1446) otp.clearReuseAsIs(); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1447) boolean old = reuseDeltas; +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1448) reuseDeltas = false; +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1449) reuseSupport.selectObjectRepresentation(this, +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1450) NullProgressMonitor.INSTANCE, +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1451) Collections.singleton(otp)); +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1452) reuseDeltas = old; +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1453) } + 1454) +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1455) private void searchForDeltas(final ProgressMonitor monitor, +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1456) final ObjectToPack[] list, final int cnt) +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1457) throws MissingObjectException, IncorrectObjectTypeException, +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1458) LargeObjectException, IOException { +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1459) int threads = config.getThreads(); +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1460) if (threads == 0) +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1461) threads = Runtime.getRuntime().availableProcessors(); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1462) if (threads <= 1 || cnt <= config.getDeltaSearchWindowSize()) +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1463) singleThreadDeltaSearch(monitor, list, cnt); +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1464) else +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1465) parallelDeltaSearch(monitor, list, cnt, threads); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1466) } + 1467) +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1468) private void singleThreadDeltaSearch(ProgressMonitor monitor, +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1469) ObjectToPack[] list, int cnt) throws IOException { +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1470) long totalWeight = 0; +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1471) for (int i = 0; i < cnt; i++) { +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1472) ObjectToPack o = list[i]; +36c6aecbe org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-11-03 18:10:02 -0500 1473) totalWeight += DeltaTask.getAdjustedWeight(o); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1474) } + 1475) +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1476) long bytesPerUnit = 1; +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1477) while (DeltaTask.MAX_METER <= (totalWeight / bytesPerUnit)) +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1478) bytesPerUnit <<= 10; +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1479) int cost = (int) (totalWeight / bytesPerUnit); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1480) if (totalWeight % bytesPerUnit != 0) +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1481) cost++; + 1482) +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1483) beginPhase(PackingPhase.COMPRESSING, monitor, cost); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1484) new DeltaWindow(config, new DeltaCache(config), reader, +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1485) monitor, bytesPerUnit, +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1486) list, 0, cnt).search(); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1487) endPhase(monitor); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1488) } + 1489) +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1490) private void parallelDeltaSearch(ProgressMonitor monitor, +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1491) ObjectToPack[] list, int cnt, int threads) throws IOException { +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1492) DeltaCache dc = new ThreadSafeDeltaCache(config); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1493) ThreadSafeProgressMonitor pm = new ThreadSafeProgressMonitor(monitor); +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1494) DeltaTask.Block taskBlock = new DeltaTask.Block(threads, config, +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1495) reader, dc, pm, +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1496) list, 0, cnt); +21e4aa2b9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:31:00 -0400 1497) taskBlock.partitionTasks(); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1498) beginPhase(PackingPhase.COMPRESSING, monitor, taskBlock.cost()); +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1499) pm.startWorkers(taskBlock.tasks.size()); + 1500) +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1501) Executor executor = config.getExecutor(); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1502) final List errors = +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1503) Collections.synchronizedList(new ArrayList(threads)); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1504) if (executor instanceof ExecutorService) { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1505) // Caller supplied us a service, use it directly. +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1506) runTasks((ExecutorService) executor, pm, taskBlock, errors); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1507) } else if (executor == null) { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1508) // Caller didn't give us a way to run the tasks, spawn up a +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1509) // temporary thread pool and make sure it tears down cleanly. +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1510) ExecutorService pool = Executors.newFixedThreadPool(threads); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1511) try { +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1512) runTasks(pool, pm, taskBlock, errors); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1513) } finally { +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1514) pool.shutdown(); +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1515) for (;;) { +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1516) try { +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1517) if (pool.awaitTermination(60, TimeUnit.SECONDS)) +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1518) break; +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1519) } catch (InterruptedException e) { +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1520) throw new IOException( +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1521) JGitText.get().packingCancelledDuringObjectsWriting); +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1522) } +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1523) } +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1524) } +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1525) } else { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1526) // The caller gave us an executor, but it might not do +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1527) // asynchronous execution. Wrap everything and hope it +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1528) // can schedule these for us. +f3ec7cf3f org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-18 11:59:45 -0400 1529) for (DeltaTask task : taskBlock.tasks) { +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1530) executor.execute(new Runnable() { +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1531) @Override +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1532) public void run() { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1533) try { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1534) task.call(); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1535) } catch (Throwable failure) { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1536) errors.add(failure); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1537) } +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1538) } +7ac182f4e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-19 19:05:08 -0500 1539) }); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1540) } +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1541) try { +bdf535de4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-10-27 11:37:31 -0400 1542) pm.waitForCompletion(); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1543) } catch (InterruptedException ie) { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1544) // We can't abort the other tasks as we have no handle. +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1545) // Cross our fingers and just break out anyway. +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1546) // +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1547) throw new IOException( +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1548) JGitText.get().packingCancelledDuringObjectsWriting); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1549) } +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1550) } + 1551) +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1552) // If any task threw an error, try to report it back as +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1553) // though we weren't using a threaded search algorithm. +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1554) // +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1555) if (!errors.isEmpty()) { +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1556) Throwable err = errors.get(0); +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1557) if (err instanceof Error) +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1558) throw (Error) err; +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1559) if (err instanceof RuntimeException) +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1560) throw (RuntimeException) err; +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1561) if (err instanceof IOException) +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1562) throw (IOException) err; + 1563) +0c259eaf1 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-12-19 18:02:34 -0500 1564) throw new IOException(err.getMessage(), err); +74e083501 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:17:30 -0400 1565) } +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1566) endPhase(monitor); +5d8a9f6f3 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-17 14:43:01 -0400 1567) } + 1568) +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1569) private static void runTasks(ExecutorService pool, +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1570) ThreadSafeProgressMonitor pm, +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1571) DeltaTask.Block tb, List errors) throws IOException { +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1572) List> futures = new ArrayList<>(tb.tasks.size()); +d0a533762 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 14:34:50 -0400 1573) for (DeltaTask task : tb.tasks) +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1574) futures.add(pool.submit(task)); + 1575) +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1576) try { +bdf535de4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-10-27 11:37:31 -0400 1577) pm.waitForCompletion(); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1578) for (Future f : futures) { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1579) try { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1580) f.get(); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1581) } catch (ExecutionException failed) { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1582) errors.add(failed.getCause()); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1583) } +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1584) } +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1585) } catch (InterruptedException ie) { +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1586) for (Future f : futures) +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1587) f.cancel(true); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1588) throw new IOException( +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1589) JGitText.get().packingCancelledDuringObjectsWriting); +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1590) } +1b783d037 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 13:50:28 -0400 1591) } + 1592) +28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1593) private void writeObjects(PackOutputStream out) throws IOException { +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1594) writeObjects(out, objectsLists[OBJ_COMMIT]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1595) writeObjects(out, objectsLists[OBJ_TAG]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1596) writeObjects(out, objectsLists[OBJ_TREE]); +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 1597) writeObjects(out, objectsLists[OBJ_BLOB]); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1598) } + 1599) +26dffbe04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 1600) private void writeObjects(PackOutputStream out, List list) +26dffbe04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 1601) throws IOException { +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1602) if (list.isEmpty()) +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1603) return; + 1604) +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1605) typeStats = stats.objectTypes[list.get(0).getType()]; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1606) long beginOffset = out.length(); + 1607) +28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1608) if (reuseSupport != null) { +28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1609) reuseSupport.writeObjects(out, list); +28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1610) } else { +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1611) for (ObjectToPack otp : list) +28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1612) out.writeObject(otp); +28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1613) } + 1614) +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1615) typeStats.bytes += out.length() - beginOffset; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1616) typeStats.cntObjects = list.size(); +26dffbe04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 1617) } + 1618) +28ba4747b org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:59:36 -0400 1619) void writeObject(PackOutputStream out, ObjectToPack otp) throws IOException { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1620) if (!otp.isWritten()) +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1621) writeObjectImpl(out, otp); +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1622) } + 1623) +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1624) private void writeObjectImpl(PackOutputStream out, ObjectToPack otp) +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1625) throws IOException { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1626) if (otp.wantWrite()) { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1627) // A cycle exists in this delta chain. This should only occur if a +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1628) // selected object representation disappeared during writing +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1629) // (for example due to a concurrent repack) and a different base +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1630) // was chosen, forcing a cycle. Select something other than a +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1631) // delta, and write this object. +5d446f410 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 13:07:14 -0400 1632) reselectNonDelta(otp); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1633) } +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1634) otp.markWantWrite(); + 1635) +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1636) while (otp.isReuseAsIs()) { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1637) writeBase(out, otp.getDeltaBase()); +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1638) if (otp.isWritten()) +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1639) return; // Delta chain cycle caused this to write already. + 1640) +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1641) crc32.reset(); +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1642) otp.setOffset(out.length()); +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1643) try { +1b2062fe3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-02 15:23:58 -0500 1644) reuseSupport.copyObjectAsIs(out, otp, reuseValidate); +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1645) out.endObject(); +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1646) otp.setCRC((int) crc32.getValue()); +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1647) typeStats.reusedObjects++; +71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 1648) if (otp.isDeltaRepresentation()) { +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1649) typeStats.reusedDeltas++; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1650) typeStats.deltaBytes += out.length() - otp.getOffset(); +71f168fcd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-02 20:17:57 -0500 1651) } +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1652) return; +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1653) } catch (StoredObjectRepresentationNotAvailableException gone) { +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1654) if (otp.getOffset() == out.length()) { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1655) otp.setOffset(0); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1656) otp.clearDeltaBase(); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1657) otp.clearReuseAsIs(); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1658) reuseSupport.selectObjectRepresentation(this, +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1659) NullProgressMonitor.INSTANCE, +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1660) Collections.singleton(otp)); +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1661) continue; +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1662) } else { +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1663) // Object writing already started, we cannot recover. +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1664) // +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1665) CorruptObjectException coe; +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1666) coe = new CorruptObjectException(otp, ""); //$NON-NLS-1$ +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1667) coe.initCause(gone); +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1668) throw coe; +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1669) } +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1670) } +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1671) } + 1672) +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1673) // If we reached here, reuse wasn't possible. +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1674) // +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1675) if (otp.isDeltaRepresentation()) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1676) writeDeltaObjectDeflate(out, otp); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1677) else +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1678) writeWholeObjectDeflate(out, otp); +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1679) out.endObject(); +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1680) otp.setCRC((int) crc32.getValue()); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1681) } + 1682) +60e51251d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1683) private void writeBase(PackOutputStream out, ObjectToPack base) +60e51251d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1684) throws IOException { +60e51251d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1685) if (base != null && !base.isWritten() && !base.isEdge()) +60e51251d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-11-18 18:55:52 -0500 1686) writeObjectImpl(out, base); +ece88b99e org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:46:05 -0400 1687) } + 1688) +f288c27e4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1689) private void writeWholeObjectDeflate(PackOutputStream out, +f288c27e4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1690) final ObjectToPack otp) throws IOException { +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1691) final Deflater deflater = deflater(); +a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1692) final ObjectLoader ldr = reader.open(otp, otp.getType()); + 1693) +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1694) crc32.reset(); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1695) otp.setOffset(out.length()); +a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1696) out.writeHeader(otp, ldr.getSize()); + 1697) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1698) deflater.reset(); +a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1699) DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater); +a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1700) ldr.copyTo(dst); +a0fd06e5c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:50:50 -0400 1701) dst.finish(); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1702) } + 1703) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1704) private void writeDeltaObjectDeflate(PackOutputStream out, +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1705) final ObjectToPack otp) throws IOException { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1706) writeBase(out, otp.getDeltaBase()); + 1707) +eb17495ca org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-10 15:58:50 -0400 1708) crc32.reset(); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 1709) otp.setOffset(out.length()); + 1710) +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1711) DeltaCache.Ref ref = otp.popCachedDelta(); +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1712) if (ref != null) { +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1713) byte[] zbuf = ref.get(); +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1714) if (zbuf != null) { +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1715) out.writeHeader(otp, otp.getCachedSize()); +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1716) out.write(zbuf); +3096a1334 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (James Kolb 2015-12-16 14:06:16 -0500 1717) typeStats.cntDeltas++; +3096a1334 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (James Kolb 2015-12-16 14:06:16 -0500 1718) typeStats.deltaBytes += out.length() - otp.getOffset(); +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1719) return; +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1720) } +a960d1429 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:15:54 -0400 1721) } + 1722) +f30fe13ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2016-12-19 02:38:41 -0500 1723) try (TemporaryBuffer.Heap delta = delta(otp)) { +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1724) out.writeHeader(otp, delta.length()); + 1725) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1726) Deflater deflater = deflater(); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1727) deflater.reset(); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1728) DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1729) delta.writeTo(dst, null); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1730) dst.finish(); +f30fe13ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2016-12-19 02:38:41 -0500 1731) } +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1732) typeStats.cntDeltas++; +bb1956e64 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-18 14:31:12 -0400 1733) typeStats.deltaBytes += out.length() - otp.getOffset(); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1734) } + 1735) +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 1736) private TemporaryBuffer.Heap delta(ObjectToPack otp) +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 1737) throws IOException { +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1738) DeltaIndex index = new DeltaIndex(buffer(otp.getDeltaBaseId())); +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1739) byte[] res = buffer(otp); + 1740) +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1741) // We never would have proposed this pair if the delta would be +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1742) // larger than the unpacked version of the object. So using it +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1743) // as our buffer limit is valid: we will never reach it. +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1744) // +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1745) TemporaryBuffer.Heap delta = new TemporaryBuffer.Heap(res.length); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1746) index.encode(delta, res); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1747) return delta; +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1748) } + 1749) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1750) private byte[] buffer(AnyObjectId objId) throws IOException { +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1751) return buffer(config, reader, objId); +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1752) } + 1753) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1754) static byte[] buffer(PackConfig config, ObjectReader or, AnyObjectId objId) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1755) throws IOException { +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1756) // PackWriter should have already pruned objects that +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1757) // are above the big file threshold, so our chances of +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1758) // the object being below it are very good. We really +dfad23bf3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 22:14:18 -0400 1759) // shouldn't be here, unless the implementation is odd. + 1760) +c11711f98 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-25 20:05:53 -0400 1761) return or.open(objId).getCachedBytes(config.getBigFileThreshold()); +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1762) } + 1763) +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1764) private Deflater deflater() { +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1765) if (myDeflater == null) +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 1766) myDeflater = new Deflater(config.getCompressionLevel()); +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1767) return myDeflater; +ad0383734 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-30 21:40:54 -0400 1768) } + 1769) +f288c27e4 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1770) private void writeChecksum(PackOutputStream out) throws IOException { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1771) packcsum = out.getDigest(); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1772) out.write(packcsum); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1773) } + 1774) +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1775) private void findObjectsToPack(@NonNull ProgressMonitor countingMonitor, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1776) @NonNull ObjectWalk walker, @NonNull Set want, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1777) @NonNull Set have, +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1778) @NonNull Set noBitmaps) throws IOException { +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1779) final long countingStart = System.currentTimeMillis(); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1780) beginPhase(PackingPhase.COUNTING, countingMonitor, ProgressMonitor.UNKNOWN); + 1781) +4275c4c1c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1782) stats.interestingObjects = Collections.unmodifiableSet(new HashSet(want)); +4275c4c1c org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 20:36:45 -0500 1783) stats.uninterestingObjects = Collections.unmodifiableSet(new HashSet(have)); +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 1784) excludeFromBitmapSelection = noBitmaps; + 1785) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1786) canBuildBitmaps = config.isBuildBitmaps() +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1787) && !shallowPack +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1788) && have.isEmpty() +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1789) && (excludeInPacks == null || excludeInPacks.length == 0); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1790) if (!shallowPack && useBitmaps) { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1791) BitmapIndex bitmapIndex = reader.getBitmapIndex(); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1792) if (bitmapIndex != null) { +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1793) BitmapWalker bitmapWalker = new BitmapWalker( +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1794) walker, bitmapIndex, countingMonitor); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1795) findObjectsToPackUsingBitmaps(bitmapWalker, want, have); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1796) endPhase(countingMonitor); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1797) stats.timeCounting = System.currentTimeMillis() - countingStart; +0e8ac496c org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-05-26 17:37:17 -0400 1798) stats.bitmapIndexMisses = bitmapWalker.getCountOfBitmapIndexMisses(); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1799) return; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1800) } +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 1801) } + 1802) +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1803) List all = new ArrayList<>(want.size() + have.size()); +2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1804) all.addAll(want); +2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1805) all.addAll(have); + 1806) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1807) final RevFlag include = walker.newFlag("include"); //$NON-NLS-1$ +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1808) final RevFlag added = walker.newFlag("added"); //$NON-NLS-1$ + 1809) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1810) walker.carry(include); + 1811) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1812) int haveEst = have.size(); +2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1813) if (have.isEmpty()) { +c218a0760 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-01-27 11:58:44 -0500 1814) walker.sort(RevSort.COMMIT_TIME_DESC); +c218a0760 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-01-27 11:58:44 -0500 1815) } else { + 1816) walker.sort(RevSort.TOPO); +2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1817) if (thin) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1818) walker.sort(RevSort.BOUNDARY, true); +c218a0760 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-01-27 11:58:44 -0500 1819) } + 1820) +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1821) List wantObjs = new ArrayList<>(want.size()); +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1822) List haveObjs = new ArrayList<>(haveEst); +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1823) List wantTags = new ArrayList<>(want.size()); + 1824) +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1825) // Retrieve the RevWalk's versions of "want" and "have" objects to +d385a7a5e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-05 18:37:36 -0400 1826) // maintain any state previously set in the RevWalk. +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1827) AsyncRevObjectQueue q = walker.parseAny(all, true); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1828) try { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1829) for (;;) { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1830) try { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1831) RevObject o = q.next(); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1832) if (o == null) +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1833) break; +2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1834) if (have.contains(o)) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1835) haveObjs.add(o); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1836) if (want.contains(o)) { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1837) o.add(include); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1838) wantObjs.add(o); +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1839) if (o instanceof RevTag) +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1840) wantTags.add((RevTag) o); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1841) } +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1842) } catch (MissingObjectException e) { +2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1843) if (ignoreMissingUninteresting +2fbcba41e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:03:24 -0500 1844) && have.contains(e.getObjectId())) +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1845) continue; +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1846) throw e; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1847) } +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1848) } +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1849) } finally { +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1850) q.release(); +f048af3fd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-08-20 20:41:27 -0400 1851) } + 1852) +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1853) if (!wantTags.isEmpty()) { +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1854) all = new ArrayList<>(wantTags.size()); +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1855) for (RevTag tag : wantTags) +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1856) all.add(tag.getObject()); +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1857) q = walker.parseAny(all, true); +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1858) try { +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1859) while (q.next() != null) { +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1860) // Just need to pop the queue item to parse the object. +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1861) } +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1862) } finally { +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1863) q.release(); +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1864) } +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1865) } + 1866) +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1867) if (walker instanceof DepthWalk.ObjectWalk) { +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1868) DepthWalk.ObjectWalk depthWalk = (DepthWalk.ObjectWalk) walker; +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1869) for (RevObject obj : wantObjs) { +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1870) depthWalk.markRoot(obj); +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1871) } +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1872) // Mark the tree objects associated with "have" commits as +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1873) // uninteresting to avoid writing redundant blobs. A normal RevWalk +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1874) // lazily propagates the "uninteresting" state from a commit to its +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1875) // tree during the walk, but DepthWalks can terminate early so +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1876) // preemptively propagate that state here. +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1877) for (RevObject obj : haveObjs) { +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1878) if (obj instanceof RevCommit) { +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1879) RevTree t = ((RevCommit) obj).getTree(); +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1880) depthWalk.markUninteresting(t); +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1881) } +7edf05530 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2016-08-04 20:20:23 -0400 1882) } + 1883) +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1884) if (unshallowObjects != null) { +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1885) for (ObjectId id : unshallowObjects) { +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1886) depthWalk.markUnshallow(walker.parseAny(id)); +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1887) } +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1888) } +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1889) } else { +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1890) for (RevObject obj : wantObjs) +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1891) walker.markStart(obj); +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1892) } +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1893) for (RevObject obj : haveObjs) +19037e8cf org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:25 -0500 1894) walker.markUninteresting(obj); + 1895) +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1896) final int maxBases = config.getDeltaSearchWindowSize(); +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1897) Set baseTrees = new HashSet<>(); +3b4448637 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2017-02-20 16:47:23 -0500 1898) BlockList commits = new BlockList<>(); +1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1899) Set roots = new HashSet<>(); +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1900) RevCommit c; +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1901) while ((c = walker.next()) != null) { +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1902) if (exclude(c)) +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1903) continue; +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1904) if (c.has(RevFlag.UNINTERESTING)) { +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1905) if (baseTrees.size() <= maxBases) +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1906) baseTrees.add(c.getTree()); +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1907) continue; +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1908) } + 1909) +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1910) commits.add(c); +1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1911) if (c.getParentCount() == 0) { +1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1912) roots.add(c.copy()); +1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1913) } +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1914) countingMonitor.update(1); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1915) } +1d7d0f95e org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-16 17:10:16 -0400 1916) stats.rootCommits = Collections.unmodifiableSet(roots); + 1917) +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1918) if (shallowPack) { +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1919) for (RevCommit cmit : commits) { +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1920) addObject(cmit, 0); +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1921) } +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1922) } else { +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1923) int commitCnt = 0; +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1924) boolean putTagTargets = false; +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1925) for (RevCommit cmit : commits) { +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1926) if (!cmit.has(added)) { +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1927) cmit.add(added); +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1928) addObject(cmit, 0); +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1929) commitCnt++; +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1930) } + 1931) +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1932) for (int i = 0; i < cmit.getParentCount(); i++) { +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1933) RevCommit p = cmit.getParent(i); +0f84b86e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Christian Halstrick 2012-06-04 10:52:36 -0400 1934) if (!p.has(added) && !p.has(RevFlag.UNINTERESTING) +0f84b86e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Christian Halstrick 2012-06-04 10:52:36 -0400 1935) && !exclude(p)) { +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1936) p.add(added); +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1937) addObject(p, 0); +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1938) commitCnt++; +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1939) } +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1940) } + 1941) +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1942) if (!putTagTargets && 4096 < commitCnt) { +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1943) for (ObjectId id : tagTargets) { +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1944) RevObject obj = walker.lookupOrNull(id); +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1945) if (obj instanceof RevCommit +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1946) && obj.has(include) +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1947) && !obj.has(RevFlag.UNINTERESTING) +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1948) && !obj.has(added)) { +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1949) obj.add(added); +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1950) addObject(obj, 0); +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1951) } +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1952) } +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1953) putTagTargets = true; +8f865bfff org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 21:15:26 -0500 1954) } +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1955) } +9952223e0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Matt Fischer 2011-08-21 17:04:23 -0400 1956) } +733780e8a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-18 00:32:03 -0500 1957) commits = null; + 1958) +99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1959) if (thin && !baseTrees.isEmpty()) { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1960) BaseSearch bases = new BaseSearch(countingMonitor, baseTrees, // +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1961) objectsMap, edgeObjects, reader); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1962) RevObject o; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1963) while ((o = walker.nextObject()) != null) { +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1964) if (o.has(RevFlag.UNINTERESTING)) +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1965) continue; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1966) if (exclude(o)) +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1967) continue; + 1968) +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1969) int pathHash = walker.getPathHashCode(); +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1970) byte[] pathBuf = walker.getPathBuffer(); +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1971) int pathLen = walker.getPathLength(); +13bcf05a9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-01 10:12:06 -0500 1972) bases.addBase(o.getType(), pathBuf, pathLen, pathHash); +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 1973) filterAndAddObject(o, o.getType(), pathHash, want); +6b62e53b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-06-28 14:47:28 -0400 1974) countingMonitor.update(1); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1975) } +99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1976) } else { +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1977) RevObject o; +99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1978) while ((o = walker.nextObject()) != null) { +99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1979) if (o.has(RevFlag.UNINTERESTING)) +99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1980) continue; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1981) if (exclude(o)) +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 1982) continue; +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 1983) filterAndAddObject(o, o.getType(), walker.getPathHashCode(), want); +99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1984) countingMonitor.update(1); +99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1985) } +99e6cfb13 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-08 18:10:11 -0400 1986) } + 1987) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1988) for (CachedPack pack : cachedPacks) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 1989) countingMonitor.update((int) pack.getObjectCount()); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 1990) endPhase(countingMonitor); +c8c4524b6 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-13 16:43:11 -0500 1991) stats.timeCounting = System.currentTimeMillis() - countingStart; +dd22bc831 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-06-02 22:49:55 -0400 1992) stats.bitmapIndexMisses = -1; +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 1993) } + 1994) +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1995) private void findObjectsToPackUsingBitmaps( +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1996) BitmapWalker bitmapWalker, Set want, +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1997) Set have) +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1998) throws MissingObjectException, IncorrectObjectTypeException, +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 1999) IOException { +9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2000) BitmapBuilder haveBitmap = bitmapWalker.findObjects(have, null, true); +9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2001) BitmapBuilder wantBitmap = bitmapWalker.findObjects(want, haveBitmap, +9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2002) false); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2003) BitmapBuilder needBitmap = wantBitmap.andNot(haveBitmap); + 2004) +6e5c71b35 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-04-24 14:31:22 -0400 2005) if (useCachedPacks && reuseSupport != null && !reuseValidate +6e5c71b35 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-04-24 14:31:22 -0400 2006) && (excludeInPacks == null || excludeInPacks.length == 0)) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2007) cachedPacks.addAll( +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2008) reuseSupport.getCachedPacksAndUpdate(needBitmap)); + 2009) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2010) for (BitmapObject obj : needBitmap) { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2011) ObjectId objectId = obj.getObjectId(); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2012) if (exclude(objectId)) { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2013) needBitmap.remove(objectId); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2014) continue; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2015) } +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2016) filterAndAddObject(objectId, obj.getType(), 0, want); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2017) } + 2018) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2019) if (thin) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2020) haveObjects = haveBitmap; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2021) } + 2022) +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2023) private static void pruneEdgesFromObjectList(List list) { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2024) final int size = list.size(); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2025) int src = 0; +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2026) int dst = 0; + 2027) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2028) for (; src < size; src++) { +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2029) ObjectToPack obj = list.get(src); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2030) if (obj.isEdge()) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2031) continue; +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2032) if (dst != src) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2033) list.set(dst, obj); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2034) dst++; +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2035) } + 2036) +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2037) while (dst < list.size()) +f67e5602a org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-07 21:23:39 -0500 2038) list.remove(list.size() - 1); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2039) } + 2040) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2041) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2042) * Include one object to the output file. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2043) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2044) * Objects are written in the order they are added. If the same object is +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2045) * added twice, it may be written twice, creating a larger than necessary +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2046) * file. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2047) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2048) * @param object +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2049) * the object to add. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2050) * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2051) * the object is an unsupported type. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2052) */ +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 2053) public void addObject(RevObject object) +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 2054) throws IncorrectObjectTypeException { +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2055) if (!exclude(object)) +065a0a812 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-01-28 10:20:26 -0500 2056) addObject(object, 0); +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 2057) } + 2058) +6d370d837 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Han-Wen Nienhuys 2018-05-15 17:05:02 -0400 2059) private void addObject(RevObject object, int pathHashCode) { +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2060) addObject(object, object.getType(), pathHashCode); +2f93a09dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-09 18:17:26 -0400 2061) } + 2062) +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2063) private void addObject( +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2064) final AnyObjectId src, final int type, final int pathHashCode) { +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2065) final ObjectToPack otp; +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2066) if (reuseSupport != null) +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2067) otp = reuseSupport.newObjectToPack(src, type); +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2068) else +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2069) otp = new ObjectToPack(src, type); +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2070) otp.setPathHash(pathHashCode); +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2071) objectsLists[type].add(otp); +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2072) objectsMap.add(otp); +be7a135e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-04 17:43:22 -0500 2073) } + 2074) +901e663a6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2018-03-19 19:28:03 -0400 2075) // Adds the given object as an object to be packed, first performing +901e663a6 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (David Pursehouse 2018-03-19 19:28:03 -0400 2076) // filtering on blobs at or exceeding a given size. +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2077) private void filterAndAddObject(@NonNull AnyObjectId src, int type, +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2078) int pathHashCode, @NonNull Set want) +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2079) throws IOException { + 2080) +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2081) // Check if this object needs to be rejected, doing the cheaper +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2082) // checks first. +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2083) boolean reject = filterBlobLimit >= 0 && +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2084) type == OBJ_BLOB && +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2085) !want.contains(src) && +32798dcfd org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-07-20 20:09:05 -0400 2086) reader.getObjectSize(src, OBJ_BLOB) > filterBlobLimit; +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2087) if (!reject) { +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2088) addObject(src, type, pathHashCode); +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2089) } +4ac32e79b org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2018-03-15 16:46:42 -0400 2090) } + 2091) +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2092) private boolean exclude(AnyObjectId objectId) { +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2093) if (excludeInPacks == null) +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2094) return false; +7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 2095) if (excludeInPackLast.contains(objectId)) +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2096) return true; +7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 2097) for (ObjectIdSet idx : excludeInPacks) { +7c58f6282 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-01-18 19:22:10 -0500 2098) if (idx.contains(objectId)) { +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2099) excludeInPackLast = idx; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2100) return true; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2101) } +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2102) } +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2103) return false; +a1a8c6d77 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-08-21 16:59:26 -0400 2104) } + 2105) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2106) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2107) * Select an object representation for this writer. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2108) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2109) * An {@link org.eclipse.jgit.lib.ObjectReader} implementation should invoke +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2110) * this method once for each representation available for an object, to +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2111) * allow the writer to find the most suitable one for the output. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2112) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2113) * @param otp +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2114) * the object being packed. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2115) * @param next +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2116) * the next available representation from the repository. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2117) */ +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2118) public void select(ObjectToPack otp, StoredObjectRepresentation next) { +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2119) int nFmt = next.getFormat(); + 2120) +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2121) if (!cachedPacks.isEmpty()) { +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2122) if (otp.isEdge()) +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2123) return; +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2124) if ((nFmt == PACK_WHOLE) | (nFmt == PACK_DELTA)) { +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2125) for (CachedPack pack : cachedPacks) { +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2126) if (pack.hasObject(otp, next)) { +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2127) otp.setEdge(); +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2128) otp.clearDeltaBase(); +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2129) otp.clearReuseAsIs(); +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2130) pruneCurrentObjectList = true; +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2131) return; +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2132) } +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2133) } +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2134) } +9f5bbb5dd org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2135) } + 2136) +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2137) if (nFmt == PACK_DELTA && reuseDeltas && reuseDeltaFor(otp)) { +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2138) ObjectId baseId = next.getDeltaBase(); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2139) ObjectToPack ptr = objectsMap.get(baseId); +461b012e9 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-02-03 16:20:22 -0500 2140) if (ptr != null && !ptr.isEdge()) { +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2141) otp.setDeltaBase(ptr); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2142) otp.setReuseAsIs(); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2143) } else if (thin && have(ptr, baseId)) { +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2144) otp.setDeltaBase(baseId); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2145) otp.setReuseAsIs(); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2146) } else { +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2147) otp.clearDeltaBase(); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2148) otp.clearReuseAsIs(); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2149) } +1a06179ea org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2010-07-28 15:13:48 -0400 2150) } else if (nFmt == PACK_WHOLE && config.isReuseObjects()) { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2151) int nWeight = next.getWeight(); +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2152) if (otp.isReuseAsIs() && !otp.isDeltaRepresentation()) { +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2153) // We've chosen another PACK_WHOLE format for this object, +8ac65d33e org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-04-01 17:40:33 -0400 2154) // choose the one that has the smaller compressed size. +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2155) // +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2156) if (otp.getWeight() <= nWeight) +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2157) return; +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2158) } +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2159) otp.clearDeltaBase(); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2160) otp.setReuseAsIs(); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2161) otp.setWeight(nWeight); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2162) } else { +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2163) otp.clearDeltaBase(); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2164) otp.clearReuseAsIs(); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2165) } + 2166) +c9707e635 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-12 15:59:02 -0400 2167) otp.setDeltaAttempted(reuseDeltas & next.wasDeltaAttempted()); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2168) otp.select(next); +bf4ffff07 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Shawn O. Pearce 2010-06-26 17:16:06 -0400 2169) } + 2170) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2171) private final boolean have(ObjectToPack ptr, AnyObjectId objectId) { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2172) return (ptr != null && ptr.isEdge()) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2173) || (haveObjects != null && haveObjects.contains(objectId)); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2174) } + 2175) +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2176) /** +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2177) * Prepares the bitmaps to be written to the bitmap index file. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2178) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2179) * Bitmaps can be used to speed up fetches and clones by storing the entire +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2180) * object graph at selected commits. Writing a bitmap index is an optional +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2181) * feature that not all pack users may require. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2182) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2183) * Called after {@link #writeIndex(OutputStream)}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2184) *

+783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2185) * To reduce memory internal state is cleared during this method, rendering +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2186) * the PackWriter instance useless for anything further than a call to write +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2187) * out the new bitmaps with {@link #writeBitmapIndex(OutputStream)}. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2188) * +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2189) * @param pm +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2190) * progress monitor to report bitmap building work. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2191) * @return whether a bitmap index may be written. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2192) * @throws java.io.IOException +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2193) * when some I/O problem occur during reading objects. +783dbf1b0 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2017-12-19 07:39:09 -0500 2194) */ +f82821728 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:15:19 -0500 2195) public boolean prepareBitmapIndex(ProgressMonitor pm) throws IOException { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2196) if (!canBuildBitmaps || getObjectCount() > Integer.MAX_VALUE +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2197) || !cachedPacks.isEmpty()) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2198) return false; + 2199) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2200) if (pm == null) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2201) pm = NullProgressMonitor.INSTANCE; + 2202) +8e83c36e2 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 2203) int numCommits = objectsLists[OBJ_COMMIT].size(); +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2204) List byName = sortByName(); +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2205) sortedByName = null; +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2206) objectsLists = null; +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2207) objectsMap = null; +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2208) writeBitmaps = new PackBitmapIndexBuilder(byName); +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2209) byName = null; + 2210) +80c7884ea org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-10-22 01:12:52 -0400 2211) PackWriterBitmapPreparer bitmapPreparer = new PackWriterBitmapPreparer( +80c7884ea org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2015-10-22 01:12:52 -0400 2212) reader, writeBitmaps, pm, stats.interestingObjects, config); + 2213) +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 2214) Collection selectedCommits = bitmapPreparer +c46c720e9 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Terry Parker 2017-05-18 18:25:21 -0400 2215) .selectCommits(numCommits, excludeFromBitmapSelection); + 2216) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2217) beginPhase(PackingPhase.BUILDING_BITMAPS, pm, selectedCommits.size()); + 2218) +ccf25f954 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Jonathan Tan 2017-11-10 18:41:31 -0500 2219) BitmapWalker walker = bitmapPreparer.newBitmapWalker(); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2220) AnyObjectId last = null; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2221) for (PackWriterBitmapPreparer.BitmapCommit cmit : selectedCommits) { +8f7d0a4fb org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Zhen Chen 2017-05-03 18:02:33 -0400 2222) if (!cmit.isReuseWalker()) { +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2223) walker = bitmapPreparer.newBitmapWalker(); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2224) } +9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2225) BitmapBuilder bitmap = walker.findObjects( +9fd1325ec org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Matthias Sohn 2014-09-26 09:45:46 -0400 2226) Collections.singleton(cmit), null, false); + 2227) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2228) if (last != null && cmit.isReuseWalker() && !bitmap.contains(last)) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2229) throw new IllegalStateException(MessageFormat.format( +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2230) JGitText.get().bitmapMissingObject, cmit.name(), +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2231) last.name())); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2232) last = cmit; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2233) writeBitmaps.addBitmap(cmit, bitmap.build(), cmit.getFlags()); + 2234) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2235) pm.update(1); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2236) } + 2237) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2238) endPhase(pm); +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2239) return true; +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2240) } + 2241) +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2242) private boolean reuseDeltaFor(ObjectToPack otp) { + 2243) int type = otp.getType(); +01a0699ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 2244) if ((type & 2) != 0) // OBJ_TREE(2) or OBJ_BLOB(3) +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2245) return true; +01a0699ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 2246) if (type == OBJ_COMMIT) +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2247) return reuseDeltaCommits; +01a0699ac org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2013-04-05 12:43:02 -0400 2248) if (type == OBJ_TAG) +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2249) return false; +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2250) return true; +751c329b3 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Shawn O. Pearce 2011-03-01 13:07:08 -0500 2251) } + 2252) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2253) private class MutableState { +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2254) /** Estimated size of a single ObjectToPack instance. */ +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2255) // Assume 64-bit pointers, since this is just an estimate. +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2256) private static final long OBJECT_TO_PACK_SIZE = +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2257) (2 * 8) // Object header +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2258) + (2 * 8) + (2 * 8) // ObjectToPack fields +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2259) + (8 + 8) // PackedObjectInfo fields +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2260) + 8 // ObjectIdOwnerMap fields +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2261) + 40 // AnyObjectId fields +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2262) + 8; // Reference in BlockList + 2263) +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2264) private final long totalDeltaSearchBytes; + 2265) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2266) private volatile PackingPhase phase; + 2267) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2268) MutableState() { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2269) phase = PackingPhase.COUNTING; +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2270) if (config.isDeltaCompress()) { +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2271) int threads = config.getThreads(); +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2272) if (threads <= 0) +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2273) threads = Runtime.getRuntime().availableProcessors(); +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2274) totalDeltaSearchBytes = (threads * config.getDeltaSearchMemoryLimit()) +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2275) + config.getBigFileThreshold(); +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2276) } else +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2277) totalDeltaSearchBytes = 0; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2278) } + 2279) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2280) State snapshot() { +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2281) long objCnt = 0; +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2282) BlockList[] lists = objectsLists; +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2283) if (lists != null) { +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2284) objCnt += lists[OBJ_COMMIT].size(); +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2285) objCnt += lists[OBJ_TREE].size(); +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2286) objCnt += lists[OBJ_BLOB].size(); +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2287) objCnt += lists[OBJ_TAG].size(); +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2288) // Exclude CachedPacks. +4bb523475 org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java (Shawn Pearce 2015-08-13 13:13:44 -0400 2289) } + 2290) +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2291) long bytesUsed = OBJECT_TO_PACK_SIZE * objCnt; +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2292) PackingPhase curr = phase; +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2293) if (curr == PackingPhase.COMPRESSING) +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2294) bytesUsed += totalDeltaSearchBytes; +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2295) return new State(curr, bytesUsed); +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2296) } +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2297) } + 2298) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2299) /** Possible states that a PackWriter can be in. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2300) public static enum PackingPhase { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2301) /** Counting objects phase. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2302) COUNTING, + 2303) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2304) /** Getting sizes phase. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2305) GETTING_SIZES, + 2306) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2307) /** Finding sources phase. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2308) FINDING_SOURCES, + 2309) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2310) /** Compressing objects phase. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2311) COMPRESSING, + 2312) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2313) /** Writing objects phase. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2314) WRITING, + 2315) +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2316) /** Building bitmaps phase. */ +dafcb8f6d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Colby Ranger 2013-03-05 14:14:45 -0500 2317) BUILDING_BITMAPS; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2318) } + 2319) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2320) /** Summary of the current state of a PackWriter. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2321) public class State { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2322) private final PackingPhase phase; + 2323) +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2324) private final long bytesUsed; + 2325) +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2326) State(PackingPhase phase, long bytesUsed) { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2327) this.phase = phase; +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2328) this.bytesUsed = bytesUsed; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2329) } + 2330) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2331) /** @return the PackConfig used to build the writer. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2332) public PackConfig getConfig() { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2333) return config; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2334) } + 2335) +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2336) /** @return the current phase of the writer. */ +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2337) public PackingPhase getPhase() { +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2338) return phase; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2339) } + 2340) +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2341) /** @return an estimate of the total memory used by the writer. */ +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2342) public long estimateBytesUsed() { +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2343) return bytesUsed; +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2344) } + 2345) +c310fa0c8 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Robin Rosenberg 2012-12-27 10:57:38 -0500 2346) @SuppressWarnings("nls") +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2347) @Override +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2348) public String toString() { +f26b79d04 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2349) return "PackWriter.State[" + phase + ", memory=" + bytesUsed + "]"; +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2350) } +16b8ebf2d org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java (Dave Borowitz 2011-11-14 13:27:45 -0500 2351) } +1a6964c82 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java (Git Development Community 2009-09-29 19:47:03 -0400 2352) }