Example usage for org.eclipse.jgit.lib BranchConfig getMerge

List of usage examples for org.eclipse.jgit.lib BranchConfig getMerge

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib BranchConfig getMerge.

Prototype

public String getMerge() 

Source Link

Document

Get the name of the upstream branch as it is called on the remote

Usage

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

License:Open Source License

private String getSuggestedBranchName() {
    if (fullBranch != null) {
        String branchName = Repository.shortenRefName(fullBranch);
        StoredConfig config = repository.getConfig();
        BranchConfig branchConfig = new BranchConfig(config, branchName);
        String merge = branchConfig.getMerge();
        if (!branchConfig.isRemoteLocal() && merge != null && merge.startsWith(Constants.R_HEADS)) {
            return Repository.shortenRefName(merge);
        }/*from ww w.jav a2 s  .c om*/
    }
    return ""; //$NON-NLS-1$
}

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

License:Open Source License

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;
    }//from   w ww  .j  a  v a 2 s. co m
    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;
}

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

License:Open Source License

private void setDefaultUpstreamConfig() {
    String branchName = Repository.shortenRefName(this.fullBranch);
    BranchConfig branchConfig = new BranchConfig(repository.getConfig(), branchName);
    boolean alreadyConfigured = branchConfig.getMerge() != null;
    BranchRebaseMode config;//from   w  w  w  .ja v a2  s  .  c o m
    if (alreadyConfigured) {
        config = PullCommand.getRebaseMode(branchName, repository.getConfig());
    } else {
        config = CreateLocalBranchOperation.getDefaultUpstreamConfig(repository,
                Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + branchName); //$NON-NLS-1$
    }
    this.upstreamConfig = config;
}

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

License:Open Source License

private void setDefaultUpstreamConfig() {
    if (this.ref != null) {
        String branchName = Repository.shortenRefName(ref.getName());
        BranchConfig branchConfig = new BranchConfig(repository.getConfig(), branchName);
        boolean alreadyConfigured = branchConfig.getMerge() != null;
        BranchRebaseMode config;/*from  w w  w . j a v a 2 s .c  o  m*/
        if (alreadyConfigured) {
            config = PullCommand.getRebaseMode(branchName, repository.getConfig());
        } else {
            config = CreateLocalBranchOperation.getDefaultUpstreamConfig(repository,
                    Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + branchName); //$NON-NLS-1$
        }
        this.upstreamConfig = config;
        this.upstreamConfigComponent.setUpstreamConfig(this.upstreamConfig);
    }
}

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

License:Open Source License

private String getSuggestedBranchName() {
    if (ref != null && !ref.getName().startsWith(Constants.R_REMOTES)) {
        StoredConfig config = repository.getConfig();
        String branchName = Repository.shortenRefName(ref.getName());

        BranchConfig branchConfig = new BranchConfig(config, branchName);
        String merge = branchConfig.getMerge();
        if (!branchConfig.isRemoteLocal() && merge != null && merge.startsWith(Constants.R_HEADS))
            return Repository.shortenRefName(merge);

        return branchName;
    } else {//from   w  ww . j ava  2  s.c  o  m
        return ""; //$NON-NLS-1$
    }
}

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

License:Open Source License

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;
    }//from  ww w .  j ava  2  s  .c o  m
    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;
}