org.eclipse.jgit.storage.file.WindowCacheConfig Java Examples

The following examples show how to use org.eclipse.jgit.storage.file.WindowCacheConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GitMigrator.java    From rtc2gitcli with MIT License 6 votes vote down vote up
void initialize(Properties props) {
	properties = props;
	commentTranslator = new CommitCommentTranslator(props);
	defaultIdent = new PersonIdent(props.getProperty("user.name", "RTC 2 git"),
			props.getProperty("user.email", "[email protected]"));
	parseElements(props.getProperty("ignore.file.extensions", ""), ignoredFileExtensions);
	// update window cache config
	WindowCacheConfig cfg = getWindowCacheConfig();
	cfg.setPackedGitOpenFiles(
			(int) parseConfigValue(props.getProperty("packedgitopenfiles"), cfg.getPackedGitOpenFiles()));
	cfg.setPackedGitLimit(parseConfigValue(props.getProperty("packedgitlimit"), cfg.getPackedGitLimit()));
	cfg.setPackedGitWindowSize(
			(int) parseConfigValue(props.getProperty("packedgitwindowsize"), cfg.getPackedGitWindowSize()));
	cfg.setPackedGitMMAP(Boolean.parseBoolean(props.getProperty("packedgitmmap")));
	cfg.setDeltaBaseCacheLimit(
			(int) parseConfigValue(props.getProperty("deltabasecachelimit"), cfg.getDeltaBaseCacheLimit()));
	long sft = parseConfigValue(props.getProperty("streamfilethreshold"), cfg.getStreamFileThreshold());
	cfg.setStreamFileThreshold(getMaxFileThresholdValue(sft, Runtime.getRuntime().maxMemory()));
}
 
Example #2
Source File: GitMigratorTest.java    From rtc2gitcli with MIT License 6 votes vote down vote up
@Test
public void testGetGitCacheConfig() throws Exception {
	props.setProperty("packedgitopenfiles", "129");
	props.setProperty("packedgitlimit", "11m");
	props.setProperty("packedgitwindowsize", "9k");
	props.setProperty("packedgitmmap", "true");
	props.setProperty("deltabasecachelimit", "11m");
	props.setProperty("streamfilethreshold", "51m");
	migrator.initialize(props);
	// check values
	WindowCacheConfig cfg = migrator.getWindowCacheConfig();
	assertEquals(129, cfg.getPackedGitOpenFiles());
	assertEquals(11 * WindowCacheConfig.MB, cfg.getPackedGitLimit());
	assertEquals(9 * WindowCacheConfig.KB, cfg.getPackedGitWindowSize());
	assertTrue(cfg.isPackedGitMMAP());
	assertEquals(11 * WindowCacheConfig.MB, cfg.getDeltaBaseCacheLimit());
	assertEquals(51 * WindowCacheConfig.MB, cfg.getStreamFileThreshold());
}
 
Example #3
Source File: CheckoutTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testLargeFile () throws Exception {
    unpack("large.dat.zip");
    File large = new File(workDir, "large.dat");
    assertTrue(large.exists());
    assertEquals(2158310, large.length());
    add();
    DirCache cache = repository.readDirCache();
    DirCacheEntry e = cache.getEntry("large.dat");
    WindowCacheConfig cfg = new WindowCacheConfig();
    cfg.setStreamFileThreshold((int) large.length() - 1);
    cfg.install();
    DirCacheCheckout.checkoutEntry(repository, e, repository.newObjectReader());
}
 
Example #4
Source File: GitMigrator.java    From rtc2gitcli with MIT License 5 votes vote down vote up
public GitMigrator(Properties properties) {
	defaultCharset = Charset.forName("UTF-8");
	ignoredFileExtensions = new HashSet<String>();
	WindowCacheConfig = new WindowCacheConfig();
	commitsAfterClean = 0;
	initialize(properties);
}
 
Example #5
Source File: GitMigrator.java    From rtc2gitcli with MIT License 5 votes vote down vote up
private int getFactor(String sign) {
	if (!sign.isEmpty()) {
		switch (sign.charAt(0)) {
		case 'k':
		case 'K':
			return org.eclipse.jgit.storage.file.WindowCacheConfig.KB;
		case 'm':
		case 'M':
			return org.eclipse.jgit.storage.file.WindowCacheConfig.MB;
		}
	}
	return 1;
}
 
Example #6
Source File: GitMigratorTest.java    From rtc2gitcli with MIT License 5 votes vote down vote up
@Test
public void testGetGitCacheConfig_defaults() throws Exception {
	// check values
	WindowCacheConfig cfg = migrator.getWindowCacheConfig();
	assertEquals(128, cfg.getPackedGitOpenFiles());
	assertEquals(10 * WindowCacheConfig.MB, cfg.getPackedGitLimit());
	assertEquals(8 * WindowCacheConfig.KB, cfg.getPackedGitWindowSize());
	assertFalse(cfg.isPackedGitMMAP());
	assertEquals(10 * WindowCacheConfig.MB, cfg.getDeltaBaseCacheLimit());
	assertEquals(50 * WindowCacheConfig.MB, cfg.getStreamFileThreshold());
}
 
Example #7
Source File: GitUtils.java    From halo with GNU General Public License v3.0 4 votes vote down vote up
private GitUtils() {
    // Config packed git MMAP
    WindowCacheConfig config = new WindowCacheConfig();
    config.setPackedGitMMAP(false);
    config.install();
}
 
Example #8
Source File: GitManagerImpl.java    From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static void reconfigureWindowCache() {
    final WindowCacheConfig windowCacheConfig = new WindowCacheConfig();
    windowCacheConfig.setPackedGitMMAP(false);
    windowCacheConfig.install();
}
 
Example #9
Source File: GitMigrator.java    From rtc2gitcli with MIT License 4 votes vote down vote up
WindowCacheConfig getWindowCacheConfig() {
	return WindowCacheConfig;
}