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