Example usage for org.eclipse.jgit.transport RemoteConfig removePushRefSpec

List of usage examples for org.eclipse.jgit.transport RemoteConfig removePushRefSpec

Introduction

In this page you can find the example usage for org.eclipse.jgit.transport RemoteConfig removePushRefSpec.

Prototype

public boolean removePushRefSpec(RefSpec s) 

Source Link

Document

Remove a push RefSpec from this remote.

Usage

From source file:org.eclipse.egit.core.internal.gerrit.GerritUtil.java

License:Open Source License

/**
 * Configure the gerrit push refspec HEAD:refs/for/<gerritBranch>
 *
 * @param remoteConfig/*from  w  w  w  .  ja  v  a  2s  . c  o  m*/
 *            the remote configuration to configure this in
 * @param gerritBranch
 *            the branch to push to review for
 */
public static void configurePushRefSpec(RemoteConfig remoteConfig, String gerritBranch) {
    List<RefSpec> pushRefSpecs = new ArrayList<RefSpec>(remoteConfig.getPushRefSpecs());
    for (RefSpec refSpec : pushRefSpecs) {
        remoteConfig.removePushRefSpec(refSpec);
    }
    remoteConfig.addPushRefSpec(new RefSpec("HEAD:" + GerritUtil.REFS_FOR + gerritBranch)); //$NON-NLS-1$
}