Search in sources :

Example 6 with BranchConfig

use of org.eclipse.jgit.lib.BranchConfig in project egit by eclipse.

the class PushBranchPage method hasDifferentUpstreamConfiguration.

private boolean hasDifferentUpstreamConfiguration() {
    String branchName = Repository.shortenRefName(ref.getName());
    BranchConfig branchConfig = new BranchConfig(repository.getConfig(), branchName);
    String remote = branchConfig.getRemote();
    // No upstream config -> don't show warning
    if (remote == null) {
        return false;
    }
    if (!remote.equals(remoteConfig.getName())) {
        return true;
    }
    String merge = branchConfig.getMerge();
    if (merge == null || !merge.equals(getFullRemoteReference())) {
        return true;
    }
    if (branchConfig.getRebaseMode() != upstreamConfig) {
        return true;
    }
    return false;
}
Also used : BranchConfig(org.eclipse.jgit.lib.BranchConfig)

Example 7 with BranchConfig

use of org.eclipse.jgit.lib.BranchConfig in project egit by eclipse.

the class PullWizardPage method hasDifferentUpstreamConfiguration.

private boolean hasDifferentUpstreamConfiguration() {
    String branchName = Repository.shortenRefName(this.fullBranch);
    BranchConfig branchConfig = new BranchConfig(repository.getConfig(), branchName);
    String remote = branchConfig.getRemote();
    // No upstream config -> don't show warning
    if (remote == null) {
        return false;
    }
    if (!remote.equals(remoteConfig.getName())) {
        return true;
    }
    String merge = branchConfig.getMerge();
    if (merge == null || !merge.equals(getFullRemoteReference())) {
        return true;
    }
    if (branchConfig.getRebaseMode() != getUpstreamConfig()) {
        return true;
    }
    return false;
}
Also used : BranchConfig(org.eclipse.jgit.lib.BranchConfig)

Example 8 with BranchConfig

use of org.eclipse.jgit.lib.BranchConfig in project egit by eclipse.

the class PullWizardPage method setDefaultUpstreamConfig.

private void setDefaultUpstreamConfig() {
    String branchName = Repository.shortenRefName(this.fullBranch);
    BranchConfig branchConfig = new BranchConfig(repository.getConfig(), branchName);
    boolean alreadyConfigured = branchConfig.getMerge() != null;
    BranchRebaseMode config;
    if (alreadyConfigured) {
        config = PullCommand.getRebaseMode(branchName, repository.getConfig());
    } else {
        config = CreateLocalBranchOperation.getDefaultUpstreamConfig(repository, Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + // $NON-NLS-1$
        branchName);
    }
    this.upstreamConfig = config;
}
Also used : BranchRebaseMode(org.eclipse.jgit.lib.BranchConfig.BranchRebaseMode) BranchConfig(org.eclipse.jgit.lib.BranchConfig)

Example 9 with BranchConfig

use of org.eclipse.jgit.lib.BranchConfig in project egit by eclipse.

the class PullWizardPage method setRemoteConfigs.

private void setRemoteConfigs() {
    remoteSelectionCombo.setItems(remoteConfigs);
    if (this.head != null) {
        String branchName = Repository.shortenRefName(this.head.getName());
        BranchConfig branchConfig = new BranchConfig(repository.getConfig(), branchName);
        String remoteName = branchConfig.getRemote();
        if (remoteName != null) {
            for (RemoteConfig rc : remoteConfigs) {
                if (remoteName.equals(rc.getName()))
                    remoteSelectionCombo.setSelectedRemote(rc);
            }
        }
    }
    remoteConfig = remoteSelectionCombo.getSelectedRemote();
    setRefAssist(remoteConfig);
}
Also used : BranchConfig(org.eclipse.jgit.lib.BranchConfig) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig)

Aggregations

BranchConfig (org.eclipse.jgit.lib.BranchConfig)9 BranchRebaseMode (org.eclipse.jgit.lib.BranchConfig.BranchRebaseMode)2 StoredConfig (org.eclipse.jgit.lib.StoredConfig)2 RemoteConfig (org.eclipse.jgit.transport.RemoteConfig)2 IOException (java.io.IOException)1