Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.URIish


   * @throws GitAPIException
   */
  public Git call() throws GitAPIException, InvalidRemoteException,
      org.eclipse.jgit.api.errors.TransportException {
    try {
      URIish u = new URIish(uri);
      Repository repository = init(u);
      FetchResult result = fetch(repository, u);
      if (!noCheckout)
        checkout(repository, result);
      return new Git(repository);
View Full Code Here


   * @throws GitAPIException
   */
  public Git call() throws GitAPIException, InvalidRemoteException,
      org.eclipse.jgit.api.errors.TransportException {
    try {
      URIish u = new URIish(uri);
      Repository repository = init(u);
      FetchResult result = fetch(repository, u);
      if (!noCheckout)
        checkout(repository, result);
      return new Git(repository);
View Full Code Here

  @Before
  public void before() throws Exception {
    repositoryFile = createProjectAndCommitToRepository();
    remoteRepositoryFile = createRemoteRepository(repositoryFile);
    // now let's clone the remote repository
    URIish uri = new URIish("file:///" + remoteRepositoryFile.getPath());
    File workdir = new File(getTestDirectory(), "ClonedRepo");

    CloneOperation op = new CloneOperation(uri, true, null, workdir,
        "refs/heads/master", "origin", 0);
    op.run(null);

    clonedRepositoryFile = new File(workdir, Constants.DOT_GIT);

    // now let's clone the remote repository
    uri = new URIish(remoteRepositoryFile.getPath());
    workdir = new File(getTestDirectory(), "ClonedRepo2");

    op = new CloneOperation(uri, true, null, workdir, "refs/heads/master",
        "origin", 0);
    op.run(null);
View Full Code Here

    clearView();
    setVerboseBranchMode(false);
    repositoryFile = createProjectAndCommitToRepository();
    remoteRepositoryFile = createRemoteRepository(repositoryFile);
    // now let's clone the remote repository
    final URIish uri = new URIish(remoteRepositoryFile.getPath());
    final File workdir = new File(getTestDirectory(), "Cloned");

    CloneOperation op = new CloneOperation(uri, true, null, workdir,
        "refs/heads/master", "origin", 0);
    op.run(null);
View Full Code Here

        remoteConfig = rc;
    }
  }

  private URIish getUri() {
    URIish urIish = null;
    if (remoteConfig.getPushURIs().size() > 0)
      urIish = remoteConfig.getPushURIs().get(0);
    else
      urIish = remoteConfig.getURIs().get(0);
    return urIish;
View Full Code Here

  private void configurePushURI() {
    List<URIish> pushURIs = new ArrayList<URIish>(remoteConfig.getPushURIs());
    for (URIish urIish : pushURIs) {
      remoteConfig.removePushURI(urIish);
    }
    URIish pushURI = gerritConfiguration.getURI();
    remoteConfig.addPushURI(pushURI);
  }
View Full Code Here

    uriText.addModifyListener(new ModifyListener() {
      public void modifyText(final ModifyEvent e) {
        eventDepth++;
        try {
          if (eventDepth == 1) {
            URIish u = new URIish(uriText.getText());
            String newUser = u.getUser();
            user.setText(newUser != null ? newUser : ""); //$NON-NLS-1$
          }
        } catch (URISyntaxException e1) {
          // empty
        } finally {
View Full Code Here

    setDefaults(uri, targetBranch);
    checkPage();
  }

  private void setDefaults(URIish uri, String targetBranch) {
    URIish newPushURI = uri;
    if (Protocol.SSH.handles(uri)) {
      newPushURI = newPushURI.setPort(GERRIT_DEFAULT_SSH_PORT);
    } else if (Protocol.GIT.handles(uri)) {
      newPushURI = newPushURI.setScheme(Protocol.SSH.getDefaultScheme());
      newPushURI = newPushURI.setPort(GERRIT_DEFAULT_SSH_PORT);
    }
    uriText.setText(newPushURI.toString());
    final String uriScheme = newPushURI.getScheme();
    if (uriScheme != null)
      scheme.select(scheme.indexOf(uriScheme));
    branch.setText(targetBranch != null ? targetBranch : Constants.MASTER);
  }
View Full Code Here

    branch.setText(targetBranch != null ? targetBranch : Constants.MASTER);
  }

  private void checkPage() {
    try {
      pushURI = new URIish(uriText.getText());
      String uriScheme = pushURI.getScheme();
      if (uriScheme != null)
        scheme.select(scheme.indexOf(uriScheme));
    } catch (URISyntaxException e) {
      setErrorMessage(e.getLocalizedMessage());
View Full Code Here

      return null;
    return new UserPasswordCredentials(user, password);
  }

  static String calcNodePath(URIish uri) {
    URIish storedURI = uri.setUser(null).setPass(null).setPath(null);
    if (uri.getPort() == -1) {
      String s = uri.getScheme();
      if ("http".equals(s)) //$NON-NLS-1$
        storedURI = storedURI.setPort(80);
      else if ("https".equals(s)) //$NON-NLS-1$
        storedURI = storedURI.setPort(443);
      else if ("ssh".equals(s) || "sftp".equals(s)) //$NON-NLS-1$ //$NON-NLS-2$
        storedURI = storedURI.setPort(22);
      else if ("ftp".equals(s)) //$NON-NLS-1$
        storedURI = storedURI.setPort(21);
    }
    String pathName = GIT_PATH_PREFIX
        + EncodingUtils.encodeSlashes(storedURI.toString());
    return pathName;
  }
View Full Code Here

TOP

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

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.