Example usage for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_AUTOSETUPREBASE

List of usage examples for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_AUTOSETUPREBASE

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_AUTOSETUPREBASE.

Prototype

String CONFIG_KEY_AUTOSETUPREBASE

To view the source code for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_AUTOSETUPREBASE.

Click Source Link

Document

The "autosetuprebase" key

Usage

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

License:Open Source License

@Test
public void pushWithRemoteUpstreamConfiguration() throws Exception {
    checkoutNewLocalBranch("foo");
    // Existing configuration
    repository.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, "foo",
            ConfigConstants.CONFIG_KEY_REMOTE, "fetch");
    repository.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, "foo",
            ConfigConstants.CONFIG_KEY_MERGE, "refs/heads/foo-on-remote");
    repository.getConfig().setEnum(ConfigConstants.CONFIG_BRANCH_SECTION, "foo",
            ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.REBASE);
    // Make sure the repository does not have autosetuprebase set
    repository.getConfig().setBoolean(ConfigConstants.CONFIG_BRANCH_SECTION, null,
            ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE, false);

    PushBranchWizardTester wizard = PushBranchWizardTester.startWizard(selectProject(), "foo");
    wizard.selectRemote("fetch");
    wizard.assertBranchName("foo-on-remote");
    wizard.assertRebaseSelected();/*from  w w  w . j a  v a2  s. c o  m*/
    assertFalse(wizard.isUpstreamConfigOverwriteWarningShown());
    wizard.selectMerge();
    assertTrue(wizard.isUpstreamConfigOverwriteWarningShown());
    wizard.deselectConfigureUpstream();
    assertFalse(wizard.isUpstreamConfigOverwriteWarningShown());
    wizard.next();
    wizard.finish();

    ObjectId remoteId = remoteRepository.resolve("foo-on-remote");
    ObjectId localId = repository.resolve("foo");
    assertEquals(localId, remoteId);

    // Still configured
    assertBranchConfig("foo", "fetch", "refs/heads/foo-on-remote", "true");
}