Example usage for org.eclipse.jgit.lib StoredConfig setEnum

List of usage examples for org.eclipse.jgit.lib StoredConfig setEnum

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib StoredConfig setEnum.

Prototype

public <T extends Enum<?>> void setEnum(final String section, final String subsection, final String name,
        final T value) 

Source Link

Document

Add or modify a configuration value.

Usage

From source file:org.eclipse.egit.core.test.op.MergeOperationTest.java

License:Open Source License

private void setMergeOptions(String branch, FastForwardMode ffMode) throws IOException {
    StoredConfig config = testRepository.getRepository().getConfig();
    config.setEnum(ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_MERGEOPTIONS,
            ffMode);//from   ww w .  ja  va  2  s  .  c  om
    config.save();
}

From source file:org.eclipse.egit.core.test.op.MergeOperationTest.java

License:Open Source License

private void setMerge(FastForwardMode ffMode) throws IOException {
    StoredConfig config = testRepository.getRepository().getConfig();
    config.setEnum(ConfigConstants.CONFIG_KEY_MERGE, null, ConfigConstants.CONFIG_KEY_FF,
            FastForwardMode.Merge.valueOf(ffMode));
    config.save();/*  w ww.j a v  a  2s . c  om*/
}

From source file:org.eclipse.egit.ui.internal.pull.PullWizard.java

License:Open Source License

private void configureUpstream() throws IOException {
    String fullBranch = this.repository.getFullBranch();
    if (fullBranch == null || !fullBranch.startsWith(Constants.R_HEADS)) {
        // Don't configure upstream for detached HEAD
        return;//from   w w  w. java2 s .  com
    }
    String remoteName = this.page.getRemoteConfig().getName();
    String fullRemoteBranchName = this.page.getFullRemoteReference();

    String localBranchName = this.repository.getBranch();
    StoredConfig config = repository.getConfig();
    config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName, ConfigConstants.CONFIG_KEY_REMOTE,
            remoteName);
    config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName, ConfigConstants.CONFIG_KEY_MERGE,
            fullRemoteBranchName);
    BranchRebaseMode rebaseMode = this.page.getUpstreamConfig();
    if (rebaseMode != null) {
        config.setEnum(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName,
                ConfigConstants.CONFIG_KEY_REBASE, rebaseMode);
    }

    config.save();
}

From source file:org.eclipse.egit.ui.internal.push.PushBranchWizard.java

License:Open Source License

private void configureUpstream() throws IOException {
    if (this.ref == null) {
        // Don't configure upstream for detached HEAD
        return;/*from  w ww.  j  a v a  2 s.  c o m*/
    }
    String remoteName = getRemoteName();
    String fullRemoteBranchName = pushBranchPage.getFullRemoteReference();
    String localBranchName = Repository.shortenRefName(this.ref.getName());

    StoredConfig config = repository.getConfig();
    config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName, ConfigConstants.CONFIG_KEY_REMOTE,
            remoteName);
    config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName, ConfigConstants.CONFIG_KEY_MERGE,
            fullRemoteBranchName);
    BranchRebaseMode rebaseMode = pushBranchPage.getUpstreamConfig();
    if (rebaseMode != null) {
        config.setEnum(ConfigConstants.CONFIG_BRANCH_SECTION, localBranchName,
                ConfigConstants.CONFIG_KEY_REBASE, rebaseMode);
    }

    config.save();
}

From source file:org.eclipse.oomph.setup.git.impl.GitCloneTaskImpl.java

License:Open Source License

private static boolean configureLineEndingConversion(SetupTaskContext context, StoredConfig config)
        throws Exception {
    OS os = context.getOS();/*from w  w w  .j  av a  2s. co  m*/
    if (os.isLineEndingConversionNeeded()) {
        if (context.isPerforming()) {
            context.log("Setting " + ConfigConstants.CONFIG_KEY_AUTOCRLF + " = true");
        }

        config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOCRLF,
                AutoCRLF.TRUE);
        return true;
    }

    return false;
}