当前位置: 首页>>代码示例>>Java>>正文


Java StoredConfig.setBoolean方法代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.StoredConfig.setBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java StoredConfig.setBoolean方法的具体用法?Java StoredConfig.setBoolean怎么用?Java StoredConfig.setBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.lib.StoredConfig的用法示例。


在下文中一共展示了StoredConfig.setBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMergeBranchNoHeadYet_196837

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public void testMergeBranchNoHeadYet_196837 () throws Exception {
    StoredConfig cfg = getRemoteRepository().getConfig();
    cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_BARE, false);
    cfg.save();
    File otherRepo = getRemoteRepository().getWorkTree();
    File original = new File(otherRepo, "f");
    GitClient clientOtherRepo = getClient(otherRepo);
    write(original, "initial content");
    clientOtherRepo.add(new File[] { original }, NULL_PROGRESS_MONITOR);
    clientOtherRepo.commit(new File[] { original }, "initial commit", null, null, NULL_PROGRESS_MONITOR);
    
    GitClient client = getClient(workDir);
    Map<String, GitTransportUpdate> updates = client.fetch(otherRepo.toURI().toString(), Arrays.asList(new String[] { "+refs/heads/master:refs/remotes/origin/master" }), NULL_PROGRESS_MONITOR);
    GitMergeResult result = client.merge("origin/master", NULL_PROGRESS_MONITOR);
    assertEquals(MergeStatus.FAST_FORWARD, result.getMergeStatus());
    assertEquals(Arrays.asList(new String[] { ObjectId.zeroId().getName(), updates.get("origin/master").getNewObjectId() }), Arrays.asList(result.getMergedCommits()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:MergeTest.java

示例2: testAddIgnoreExecutable

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public void testAddIgnoreExecutable () throws Exception {
    if (isWindows()) {
        // no reason to test on windows
        return;
    }
    File f = new File(workDir, "f");
    write(f, "hi, i am executable");
    f.setExecutable(true);
    File[] roots = { f };
    GitClient client = getClient(workDir);
    StoredConfig config = repository.getConfig();
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, false);
    config.save();
    // add should not set executable bit in index
    add(roots);
    Map<File, GitStatus> statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_ADDED, Status.STATUS_NORMAL, Status.STATUS_ADDED, false);
    
    // index should differ from wt
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, true);
    config.save();
    statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_ADDED, Status.STATUS_MODIFIED, Status.STATUS_ADDED, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:AddTest.java

示例3: clone

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public static void clone(String url, File target) throws GitAPIException, IOException
{
    System.out.println( "Starting clone of " + url + " to " + target );

    Git result = Git.cloneRepository().setURI( url ).setDirectory( target ).call();

    try
    {
        StoredConfig config = result.getRepository().getConfig();
        config.setBoolean( "core", null, "autocrlf", autocrlf );
        config.save();

        System.out.println( "Cloned git repository " + url + " to " + target.getAbsolutePath() + ". Current HEAD: " + commitHash( result ) );
    } finally
    {
        result.close();
    }
}
 
开发者ID:finalchild,项目名称:BuilderTools,代码行数:19,代码来源:Builder.java

示例4: setupRebaseFlag

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
private void setupRebaseFlag (Repository repository) throws IOException {
    Ref baseRef = repository.getRef(revision);
    if (baseRef != null && baseRef.getName().startsWith(Constants.R_REMOTES)) {
        StoredConfig config = repository.getConfig();
        String autosetupRebase = config.getString(ConfigConstants.CONFIG_BRANCH_SECTION,
                null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE);
        boolean rebase = ConfigConstants.CONFIG_KEY_ALWAYS.equals(autosetupRebase)
                || ConfigConstants.CONFIG_KEY_REMOTE.equals(autosetupRebase);
        if (rebase && !config.getNames(ConfigConstants.CONFIG_BRANCH_SECTION, branchName).isEmpty()) {
            config.setBoolean(ConfigConstants.CONFIG_BRANCH_SECTION, branchName,
                    ConfigConstants.CONFIG_KEY_REBASE, rebase);
            config.save();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:CreateBranchCommand.java

示例5: setupRebaseFlag

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
private void setupRebaseFlag (Repository repository) throws IOException {
    StoredConfig config = repository.getConfig();
    String autosetupRebase = config.getString(ConfigConstants.CONFIG_BRANCH_SECTION,
            null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE);
    boolean rebase = ConfigConstants.CONFIG_KEY_ALWAYS.equals(autosetupRebase)
            || ConfigConstants.CONFIG_KEY_REMOTE.equals(autosetupRebase);
    if (rebase) {
        config.setBoolean(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName,
                ConfigConstants.CONFIG_KEY_REBASE, rebase);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:SetUpstreamBranchCommand.java

示例6: testIgnoreExecutable

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public void testIgnoreExecutable () throws Exception {
    if (isWindows()) {
        // no reason to test on win
        return;
    }
    File f = new File(workDir, "f");
    write(f, "hi, i am executable");
    f.setExecutable(true);
    File[] roots = { f };
    add(roots);
    commit(roots);
    GitClient client = getClient(workDir);
    Map<File, GitStatus> statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_NORMAL, Status.STATUS_NORMAL, Status.STATUS_NORMAL, false);
    
    f.setExecutable(false);
    statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_NORMAL, Status.STATUS_MODIFIED, Status.STATUS_MODIFIED, false);
    
    StoredConfig config = repository.getConfig();
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, false);
    config.save();
    statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_NORMAL, Status.STATUS_NORMAL, Status.STATUS_NORMAL, false);
    
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, true);
    config.save();
    add(roots);
    statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_MODIFIED, Status.STATUS_NORMAL, Status.STATUS_MODIFIED, false);
    
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, false);
    config.save();
    add(roots);
    statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_MODIFIED, Status.STATUS_NORMAL, Status.STATUS_NORMAL, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:StatusTest.java

示例7: testAddKeepExecutableInIndex

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public void testAddKeepExecutableInIndex () throws Exception {
    if (isWindows()) {
        // no reason to test on windows
        return;
    }
    File f = new File(workDir, "f");
    write(f, "hi, i am executable");
    f.setExecutable(true);
    File[] roots = { f };
    GitClient client = getClient(workDir);
    add(roots);
    Map<File, GitStatus> statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_ADDED, Status.STATUS_NORMAL, Status.STATUS_ADDED, false);
    
    StoredConfig config = repository.getConfig();
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, false);
    config.save();
    // add should not overwrite executable bit in index
    f.setExecutable(false);
    add(roots);
    statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_ADDED, Status.STATUS_NORMAL, Status.STATUS_ADDED, false);
    
    // index should differ from wt
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, true);
    config.save();
    statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_ADDED, Status.STATUS_MODIFIED, Status.STATUS_ADDED, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:AddTest.java

示例8: testUpdateIndexIgnoreExecutable

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public void testUpdateIndexIgnoreExecutable () throws Exception {
    if (isWindows()) {
        // no reason to test on windows
        return;
    }
    File f = new File(workDir, "f");
    write(f, "hi, i am not executable");
    File[] roots = { f };
    add(roots);
    commit(roots);
    f.setExecutable(true);
    GitClient client = getClient(workDir);
    StoredConfig config = repository.getConfig();
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, false);
    config.save();
    write(f, "hi, i am executable");
    // add should not set executable bit in index
    add(roots);
    Map<File, GitStatus> statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_MODIFIED, Status.STATUS_NORMAL, Status.STATUS_MODIFIED, false);
    
    // index should differ from wt
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, true);
    config.save();
    statuses = client.getStatus(roots, NULL_PROGRESS_MONITOR);
    assertStatus(statuses, workDir, f, true, Status.STATUS_MODIFIED, Status.STATUS_MODIFIED, Status.STATUS_MODIFIED, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:AddTest.java

示例9: enableInsecureReceiving

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
/**
 * To allow performing push operations from the cloned repository to remote (served by this server) let's
 * skip authorization for HTTP.
 */
private void enableInsecureReceiving(Repository repository) {
    final StoredConfig config = repository.getConfig();
    config.setBoolean("http", null, "receivepack", true);
    try {
        config.save();
    } catch (IOException e) {
        throw new RuntimeException("Unable to save http.receivepack=true config", e);
    }
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:14,代码来源:EmbeddedHttpGitServer.java

示例10: setSparseCheckout

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
private void setSparseCheckout(File gitDir, Set<String> checkoutFiles) throws GitException {
    try (Git git = gitOpen()) {
        StoredConfig config = git.getRepository().getConfig();
        config.setBoolean("core", null, "sparseCheckout", true);
        config.save();

        Path sparseCheckoutPath = Paths.get(gitDir.getAbsolutePath(), "info", "sparse-checkout");
        try {
            Files.createDirectory(sparseCheckoutPath.getParent());
            Files.createFile(sparseCheckoutPath);
        } catch (FileAlreadyExistsException ignore) {
        }

        Charset charset = Charset.forName("UTF-8");

        // load all existing
        Set<String> exists = new HashSet<>();
        try (BufferedReader reader = Files.newBufferedReader(sparseCheckoutPath, charset)) {
            exists.add(reader.readLine());
        }

        // write
        try (BufferedWriter writer = Files.newBufferedWriter(sparseCheckoutPath, charset)) {
            if (!exists.isEmpty()) {
                writer.newLine();
            }

            for (String checkoutFile : checkoutFiles) {
                if (exists.contains(checkoutFile)) {
                    continue;
                }
                writer.write(checkoutFile);
                writer.newLine();
            }
        }

    } catch (Throwable e) {
        throw new GitException("Fail to set sparse checkout config", e);
    }
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:41,代码来源:JGitBasedClient.java

示例11: initConfig

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
private void initConfig() throws IOException {
	StoredConfig config = git.getRepository().getConfig();
	config.setBoolean("core", null, "ignoreCase", false);
	config.setString("core", null, "autocrlf", File.separatorChar == '/' ? "input" : "true");
	config.setBoolean("http", null, "sslverify", false);
	config.setString("push", null, "default", "simple");
	fillConfigFromProperties(config);
	config.save();
}
 
开发者ID:rtcTo,项目名称:rtc2gitcli,代码行数:10,代码来源:GitMigrator.java

示例12: run

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public void run(IProgressMonitor monitor)
		throws InvocationTargetException, InterruptedException {
	String stableBranch = "refs/remotes/origin/" + settings.get(CreateChangeBranchDialog.PROP_STABLE_BRANCH);
	String simpleBranchName = "changes/" + settings.get(CreateChangeBranchDialog.PROP_STABLE_BRANCH)
			 + "/" + settings.get(CreateChangeBranchDialog.PROP_CHANGE_BRANCH_NAME);
	String changeBranch = "refs/heads/" + simpleBranchName;
	try {
		Ref stable = repository.getRef(stableBranch);
		AnyObjectId oid = stable.getLeaf().getObjectId();
		
		RefUpdate refUpdate = repository.updateRef(changeBranch);
		refUpdate.setNewObjectId(oid);
		
		Result res = refUpdate.update();
		switch (res) {
			case FAST_FORWARD: case NEW: case FORCED:
			case NO_CHANGE: case RENAMED:
				//we are fine;
				break;
			default:
				throw new RuntimeException("Cannot create change branch: " + res.toString());
		}
		
		//configure for pull
		StoredConfig config = repository.getConfig();
		config.setString("branch", simpleBranchName, "remote", "origin");  //$NON-NLS-1$//$NON-NLS-2$
		config.setString("branch", simpleBranchName, "merge", "refs/heads/" + settings.get(CreateChangeBranchDialog.PROP_STABLE_BRANCH));  //$NON-NLS-1$//$NON-NLS-2$
		config.setBoolean("branch", simpleBranchName, "rebase", true);  //$NON-NLS-1$//$NON-NLS-2$
		
		
		if ((Boolean)settings.get(CreateChangeBranchDialog.PROP_CHECKOUT)) {
			new SwitchToChangeBranchCommand().execute(event, repository, changeBranch);
		}
	} catch (Exception e) {
       	RepositoryUtils.handleException(e);
	}
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:38,代码来源:NewChangeBranchCommand.java

示例13: GitRepository

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
/**
 * Creates a new Git-backed repository.
 *
 * @param repoDir the location of this repository
 * @param format the repository format
 * @param repositoryWorker the {@link Executor} which will perform the blocking repository operations
 * @param creationTimeMillis the creation time
 * @param author the user who initiated the creation of this repository
 *
 * @throws StorageException if failed to create a new repository
 */
GitRepository(Project parent, File repoDir, GitRepositoryFormat format, Executor repositoryWorker,
              long creationTimeMillis, Author author) {

    this.parent = requireNonNull(parent, "parent");
    name = requireNonNull(repoDir, "repoDir").getName();
    this.repositoryWorker = requireNonNull(repositoryWorker, "repositoryWorker");
    this.format = requireNonNull(format, "format");

    requireNonNull(author, "author");

    final RepositoryBuilder repositoryBuilder = new RepositoryBuilder().setGitDir(repoDir).setBare();
    boolean success = false;
    try {
        // Create an empty repository with format version 0 first.
        try (org.eclipse.jgit.lib.Repository initRepo = repositoryBuilder.build()) {
            if (exist(repoDir)) {
                throw new StorageException(
                        "failed to create a repository at: " + repoDir + " (exists already)");
            }

            initRepo.create(true);

            final StoredConfig config = initRepo.getConfig();
            if (format == GitRepositoryFormat.V1) {
                // Update the repository settings to upgrade to format version 1 and reftree.
                config.setInt(CONFIG_CORE_SECTION, null, CONFIG_KEY_REPO_FORMAT_VERSION, 1);
            }

            // Disable hidden files, symlinks and file modes we do not use.
            config.setEnum(CONFIG_CORE_SECTION, null, CONFIG_KEY_HIDEDOTFILES, HideDotFiles.FALSE);
            config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_SYMLINKS, false);
            config.setBoolean(CONFIG_CORE_SECTION, null, CONFIG_KEY_FILEMODE, false);

            // Set the diff algorithm.
            config.setString(CONFIG_DIFF_SECTION, null, CONFIG_KEY_ALGORITHM, "histogram");

            // Disable rename detection which we do not use.
            config.setBoolean(CONFIG_DIFF_SECTION, null, CONFIG_KEY_RENAMES, false);

            config.save();
        }

        // Re-open the repository with the updated settings and format version.
        jGitRepository = new RepositoryBuilder().setGitDir(repoDir).build();

        // Initialize the master branch.
        final RefUpdate head = jGitRepository.updateRef(Constants.HEAD);
        head.disableRefLog();
        head.link(Constants.R_HEADS + Constants.MASTER);

        // Initialize the commit ID database.
        commitIdDatabase = new CommitIdDatabase(jGitRepository);

        // Insert the initial commit into the master branch.
        commit0(null, Revision.INIT, creationTimeMillis, author,
                "Create a new repository", "", Markup.PLAINTEXT,
                Collections.emptyList(), true);

        headRevision = Revision.INIT;
        success = true;
    } catch (IOException e) {
        throw new StorageException("failed to create a repository at: " + repoDir, e);
    } finally {
        if (!success) {
            close();
            // Failed to create a repository. Remove any cruft so that it is not loaded on the next run.
            deleteCruft(repoDir);
        }
    }
}
 
开发者ID:line,项目名称:centraldogma,代码行数:82,代码来源:GitRepository.java

示例14: execute

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public Optional<Git> execute() throws InvalidRemoteException {
    final Git git = Git.createRepository(repoDir,
                                         null);

    if (git != null) {
        final Collection<RefSpec> refSpecList;
        if (isMirror) {
            refSpecList = singletonList(new RefSpec("+refs/*:refs/*"));
        } else {
            refSpecList = emptyList();
        }
        final Pair<String, String> remote = Pair.newPair("origin",
                                                         origin);
        git.fetch(credentialsProvider,
                  remote,
                  refSpecList);

        if (isMirror) {
            final StoredConfig config = git.getRepository().getConfig();
            config.setBoolean("remote",
                              "origin",
                              "mirror",
                              true);
            try {
                config.save();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        git.syncRemote(remote);

        if (git.isKetchEnabled()) {
            git.convertRefTree();
            git.updateLeaders(leaders);
        }

        git.setHeadAsInitialized();

        return Optional.of(git);
    }

    return Optional.empty();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:45,代码来源:Clone.java

示例15: updateConfiguration

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
/**
 * Updates the Gitblit configuration for the specified repository.
 * 
 * @param r
 *            the Git repository
 * @param repository
 *            the Gitblit repository model
 */
public void updateConfiguration(Repository r, RepositoryModel repository) {
	StoredConfig config = r.getConfig();
	config.setString(Constants.CONFIG_GITBLIT, null, "description", repository.description);
	config.setString(Constants.CONFIG_GITBLIT, null, "owner", ArrayUtils.toString(repository.owners));
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useTickets", repository.useTickets);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useDocs", repository.useDocs);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useIncrementalPushTags", repository.useIncrementalPushTags);
	if (StringUtils.isEmpty(repository.incrementalPushTagPrefix) ||
			repository.incrementalPushTagPrefix.equals(settings.getString(Keys.git.defaultIncrementalPushTagPrefix, "r"))) {
		config.unset(Constants.CONFIG_GITBLIT, null, "incrementalPushTagPrefix");
	} else {
		config.setString(Constants.CONFIG_GITBLIT, null, "incrementalPushTagPrefix", repository.incrementalPushTagPrefix);
	}
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "allowForks", repository.allowForks);
	config.setString(Constants.CONFIG_GITBLIT, null, "accessRestriction", repository.accessRestriction.name());
	config.setString(Constants.CONFIG_GITBLIT, null, "authorizationControl", repository.authorizationControl.name());
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "verifyCommitter", repository.verifyCommitter);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "showRemoteBranches", repository.showRemoteBranches);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFrozen", repository.isFrozen);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "showReadme", repository.showReadme);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSizeCalculation", repository.skipSizeCalculation);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSummaryMetrics", repository.skipSummaryMetrics);
	config.setString(Constants.CONFIG_GITBLIT, null, "federationStrategy",
			repository.federationStrategy.name());
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFederated", repository.isFederated);
	config.setString(Constants.CONFIG_GITBLIT, null, "gcThreshold", repository.gcThreshold);
	if (repository.gcPeriod == settings.getInteger(Keys.git.defaultGarbageCollectionPeriod, 7)) {
		// use default from config
		config.unset(Constants.CONFIG_GITBLIT, null, "gcPeriod");
	} else {
		config.setInt(Constants.CONFIG_GITBLIT, null, "gcPeriod", repository.gcPeriod);
	}
	if (repository.lastGC != null) {
		config.setString(Constants.CONFIG_GITBLIT, null, "lastGC", new SimpleDateFormat(Constants.ISO8601).format(repository.lastGC));
	}
	if (repository.maxActivityCommits == settings.getInteger(Keys.web.maxActivityCommits, 0)) {
		// use default from config
		config.unset(Constants.CONFIG_GITBLIT, null, "maxActivityCommits");
	} else {
		config.setInt(Constants.CONFIG_GITBLIT, null, "maxActivityCommits", repository.maxActivityCommits);
	}

	updateList(config, "federationSets", repository.federationSets);
	updateList(config, "preReceiveScript", repository.preReceiveScripts);
	updateList(config, "postReceiveScript", repository.postReceiveScripts);
	updateList(config, "mailingList", repository.mailingLists);
	updateList(config, "indexBranch", repository.indexedBranches);
	updateList(config, "metricAuthorExclusions", repository.metricAuthorExclusions);
	
	// User Defined Properties
	if (repository.customFields != null) {
		if (repository.customFields.size() == 0) {
			// clear section
			config.unsetSection(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS);
		} else {
			for (Entry<String, String> property : repository.customFields.entrySet()) {
				// set field
				String key = property.getKey();
				String value = property.getValue();
				config.setString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, key, value);
			}
		}
	}

	try {
		config.save();
	} catch (IOException e) {
		logger.error("Failed to save repository config!", e);
	}
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:79,代码来源:GitBlit.java


注:本文中的org.eclipse.jgit.lib.StoredConfig.setBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。