當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。