Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RemoteConfig


      branchText.add(ref.getName());
  }

  private void addBranchItemsForRemote(String remote) throws IOException,
      URISyntaxException {
    RemoteConfig remoteConfig = new RemoteConfig(myConfig, remote);
    List<RefSpec> fetchSpecs = remoteConfig.getFetchRefSpecs();
    if (fetchSpecs.isEmpty()) {
      return;
    }

    Collection<Ref> allRefs = myRepository.getRefDatabase()
View Full Code Here


public class SimpleFetchActionHandler extends RepositoryActionHandler {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    final Repository repository = getRepository(true, event);
    if (repository == null)
      return null;
    RemoteConfig config = SimpleConfigureFetchDialog
        .getConfiguredRemote(repository);
    if (config == null) {
      MessageDialog
          .openInformation(
              getShell(event),
View Full Code Here

  public Object execute(ExecutionEvent event) throws ExecutionException {
    final Repository repository = getRepository(true, event);
    if (repository == null)
      return null;
    Shell shell = getShell(event);
    RemoteConfig config = SimpleConfigurePushDialog
        .getConfiguredRemote(repository);

    pushOrConfigure(repository, config, shell);
    return null;
  }
View Full Code Here

    case REMOTE: {

      List<RepositoryTreeNode<String>> children = new ArrayList<RepositoryTreeNode<String>>();

      String remoteName = (String) node.getObject();
      RemoteConfig rc;
      try {
        rc = new RemoteConfig(node.getRepository().getConfig(),
            remoteName);
      } catch (URISyntaxException e) {
        return handleException(e, node);
      }

      if (!rc.getURIs().isEmpty())
        children.add(new FetchNode(node, node.getRepository(), rc
            .getURIs().get(0).toPrivateString()));

      int uriCount = rc.getPushURIs().size();
      if (uriCount == 0 && !rc.getURIs().isEmpty())
        uriCount++;

      // show push if either a fetch or push URI is specified and
      // at least one push specification
      if (uriCount > 0) {
        URIish firstUri;
        if (!rc.getPushURIs().isEmpty())
          firstUri = rc.getPushURIs().get(0);
        else
          firstUri = rc.getURIs().get(0);

        if (uriCount == 1)
          children.add(new PushNode(node, node.getRepository(),
              firstUri.toPrivateString()));
        else
View Full Code Here

  @Test
  public void shouldReturnDstMergeForRemoteBranch() throws Exception {
    // given
    StoredConfig config = repo.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "origin");
    remoteConfig.setFetchRefSpecs(Arrays.asList(new RefSpec("+refs/heads/*:refs/remotes/origin/*")));
    remoteConfig.update(config);

    GitSynchronizeData gsd = new GitSynchronizeData(repo, HEAD,
        "refs/remotes/origin/master", false);

    assertThat(gsd.getDstRemoteName(), is("origin"));
View Full Code Here

*/
public class FetchConfiguredRemoteCommand extends
    RepositoriesViewCommandHandler<RepositoryTreeNode> {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryTreeNode node = getSelectedNodes(event).get(0);
    RemoteConfig config = getRemoteConfig(node);
    if (config == null) {
      MessageDialog
          .openInformation(
              getShell(event),
              UIText.SimpleFetchActionHandler_NothingToFetchDialogTitle,
View Full Code Here

  private RemoteConfig getRemoteConfig(RepositoryTreeNode node)
      throws ExecutionException {
    if (node instanceof FetchNode)
      try {
        RemoteNode remote = (RemoteNode) node.getParent();
        return  new RemoteConfig(node.getRepository().getConfig(),
            remote.getObject());
      } catch (URISyntaxException e) {
        throw new ExecutionException(e.getMessage());
      }

    if (node instanceof RemoteNode)
      try {
        RemoteNode remote = (RemoteNode) node;
        return new RemoteConfig(node.getRepository().getConfig(),
            remote.getObject());
      } catch (URISyntaxException e) {
        throw new ExecutionException(e.getMessage());
      }
View Full Code Here

*/
public class PushConfiguredRemoteCommand extends
    RepositoriesViewCommandHandler<RepositoryTreeNode<?>> {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryTreeNode node = getSelectedNodes(event).get(0);
    RemoteConfig config = getRemoteConfig(node);
    if (config == null) {
      MessageDialog.openInformation(getShell(event),
          UIText.SimplePushActionHandler_NothingToPushDialogTitle,
          UIText.SimplePushActionHandler_NothingToPushDialogMessage);
      return null;
    }
    new PushOperationUI(node.getRepository(), config.getName(), false)
        .start();
    return null;
  }
View Full Code Here

        remoteNode = (RemoteNode) node.getParent();
      else
        remoteNode = (RemoteNode) node;

      try {
        RemoteConfig config = new RemoteConfig(remoteNode
            .getRepository().getConfig(), remoteNode.getObject());
        boolean fetchConfigured = !config.getFetchRefSpecs().isEmpty();
        boolean pushConfigured = !config.getPushRefSpecs().isEmpty();
        if (fetchConfigured || pushConfigured)
          return config;
        else
          return null;
      } catch (URISyntaxException e) {
View Full Code Here

  public void prepare() throws Exception {
    Repository childRepository = lookupRepository(childRepositoryFile);

    Repository repository = lookupRepository(repositoryFile);
    StoredConfig config = repository.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "origin");
    remoteConfig.addURI(new URIish(childRepository.getDirectory().getParentFile().toURI().toURL()));
    remoteConfig.addFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
    remoteConfig.update(config);

    config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, "master", ConfigConstants.CONFIG_KEY_REMOTE, "origin");
    config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, "master", ConfigConstants.CONFIG_KEY_MERGE, "refs/heads/master");
    config.save();

View Full Code Here

TOP

Related Classes of org.eclipse.jgit.transport.RemoteConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.