Merge changes I11631afb,Iaa51a46a
* changes: Externalize error messages used in DfsGarbageCollector Use try-with-resource to close resources in DfsGarbageCollector
This commit is contained in:
commit
2b2cd4ba53
|
@ -231,6 +231,7 @@ fileCannotBeDeleted=File cannot be deleted: {0}
|
|||
fileIsTooBigForThisConvenienceMethod=File is too big for this convenience method ({0} bytes).
|
||||
fileIsTooLarge=File is too large: {0}
|
||||
fileModeNotSetForPath=FileMode not set for path {0}
|
||||
findingGarbage=Finding garbage
|
||||
flagIsDisposed={0} is disposed.
|
||||
flagNotFromThis={0} not from this.
|
||||
flagsAlreadyCreated={0} flags already created.
|
||||
|
@ -503,6 +504,7 @@ statelessRPCRequiresOptionToBeEnabled=stateless RPC requires {0} to be enabled
|
|||
submoduleExists=Submodule ''{0}'' already exists in the index
|
||||
submoduleParentRemoteUrlInvalid=Cannot remove segment from remote url ''{0}''
|
||||
submodulesNotSupported=Submodules are not supported
|
||||
supportOnlyPackIndexVersion2=Only support index version 2
|
||||
symlinkCannotBeWrittenAsTheLinkTarget=Symlink "{0}" cannot be written as the link target cannot be read from within Java.
|
||||
systemConfigFileInvalid=Systen wide config file {0} is invalid {1}
|
||||
tagAlreadyExists=tag ''{0}'' already exists
|
||||
|
|
|
@ -290,6 +290,7 @@ public static JGitText get() {
|
|||
/***/ public String fileIsTooBigForThisConvenienceMethod;
|
||||
/***/ public String fileIsTooLarge;
|
||||
/***/ public String fileModeNotSetForPath;
|
||||
/***/ public String findingGarbage;
|
||||
/***/ public String flagIsDisposed;
|
||||
/***/ public String flagNotFromThis;
|
||||
/***/ public String flagsAlreadyCreated;
|
||||
|
@ -562,6 +563,7 @@ public static JGitText get() {
|
|||
/***/ public String submoduleExists;
|
||||
/***/ public String submodulesNotSupported;
|
||||
/***/ public String submoduleParentRemoteUrlInvalid;
|
||||
/***/ public String supportOnlyPackIndexVersion2;
|
||||
/***/ public String symlinkCannotBeWrittenAsTheLinkTarget;
|
||||
/***/ public String systemConfigFileInvalid;
|
||||
/***/ public String tagAlreadyExists;
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jgit.internal.JGitText;
|
||||
import org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource;
|
||||
import org.eclipse.jgit.internal.storage.file.PackIndex;
|
||||
import org.eclipse.jgit.internal.storage.pack.PackExt;
|
||||
|
@ -188,7 +189,8 @@ public boolean pack(ProgressMonitor pm) throws IOException {
|
|||
if (pm == null)
|
||||
pm = NullProgressMonitor.INSTANCE;
|
||||
if (packConfig.getIndexVersion() != 2)
|
||||
throw new IllegalStateException("Only index version 2");
|
||||
throw new IllegalStateException(
|
||||
JGitText.get().supportOnlyPackIndexVersion2);
|
||||
|
||||
ctx = (DfsReader) objdb.newReader();
|
||||
try {
|
||||
|
@ -272,14 +274,11 @@ private void packHeads(ProgressMonitor pm) throws IOException {
|
|||
if (allHeads.isEmpty())
|
||||
return;
|
||||
|
||||
PackWriter pw = newPackWriter();
|
||||
try {
|
||||
try (PackWriter pw = newPackWriter()) {
|
||||
pw.setTagTargets(tagTargets);
|
||||
pw.preparePack(pm, allHeads, Collections.<ObjectId> emptySet());
|
||||
if (0 < pw.getObjectCount())
|
||||
writePack(GC, pw, pm);
|
||||
} finally {
|
||||
pw.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,15 +286,12 @@ private void packRest(ProgressMonitor pm) throws IOException {
|
|||
if (nonHeads.isEmpty())
|
||||
return;
|
||||
|
||||
PackWriter pw = newPackWriter();
|
||||
try {
|
||||
try (PackWriter pw = newPackWriter()) {
|
||||
for (PackWriter.ObjectIdSet packedObjs : newPackObj)
|
||||
pw.excludeObjects(packedObjs);
|
||||
pw.preparePack(pm, nonHeads, allHeads);
|
||||
if (0 < pw.getObjectCount())
|
||||
writePack(GC, pw, pm);
|
||||
} finally {
|
||||
pw.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,12 +303,11 @@ private void packGarbage(ProgressMonitor pm) throws IOException {
|
|||
cfg.setDeltaCompress(false);
|
||||
cfg.setBuildBitmaps(false);
|
||||
|
||||
PackWriter pw = new PackWriter(cfg, ctx);
|
||||
pw.setDeltaBaseAsOffset(true);
|
||||
pw.setReuseDeltaCommits(true);
|
||||
try {
|
||||
RevWalk pool = new RevWalk(ctx);
|
||||
pm.beginTask("Finding garbage", objectsBefore());
|
||||
try (PackWriter pw = new PackWriter(cfg, ctx);
|
||||
RevWalk pool = new RevWalk(ctx)) {
|
||||
pw.setDeltaBaseAsOffset(true);
|
||||
pw.setReuseDeltaCommits(true);
|
||||
pm.beginTask(JGitText.get().findingGarbage, objectsBefore());
|
||||
for (DfsPackFile oldPack : packsBefore) {
|
||||
PackIndex oldIdx = oldPack.getPackIndex(ctx);
|
||||
for (PackIndex.MutableEntry ent : oldIdx) {
|
||||
|
@ -328,8 +323,6 @@ private void packGarbage(ProgressMonitor pm) throws IOException {
|
|||
pm.endTask();
|
||||
if (0 < pw.getObjectCount())
|
||||
writePack(UNREACHABLE_GARBAGE, pw, pm);
|
||||
} finally {
|
||||
pw.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue