Example usage for org.eclipse.jgit.transport Transport getURI

List of usage examples for org.eclipse.jgit.transport Transport getURI

Introduction

In this page you can find the example usage for org.eclipse.jgit.transport Transport getURI.

Prototype

public URIish getURI() 

Source Link

Document

Get the URI this transport connects to.

Usage

From source file:org.eclipse.orion.server.git.jobs.PullJob.java

License:Open Source License

private IStatus doPull() throws IOException, GitAPIException, CoreException {
    Repository db = new FileRepository(GitUtils.getGitDir(path));

    Git git = new Git(db);
    PullCommand pc = git.pull();/*from w  ww.  j  a  va2s  . co  m*/
    pc.setCredentialsProvider(credentials);
    pc.setTransportConfigCallback(new TransportConfigCallback() {
        @Override
        public void configure(Transport t) {
            credentials.setUri(t.getURI());
        }
    });
    PullResult pullResult = pc.call();

    // handle result
    if (pullResult.isSuccessful()) {
        return Status.OK_STATUS;
    } else {

        FetchResult fetchResult = pullResult.getFetchResult();

        IStatus fetchStatus = FetchJob.handleFetchResult(fetchResult);
        if (!fetchStatus.isOK()) {
            return fetchStatus;
        }

        MergeStatus mergeStatus = pullResult.getMergeResult().getMergeStatus();
        if (mergeStatus.isSuccessful()) {
            return Status.OK_STATUS;
        } else {
            return new Status(IStatus.ERROR, GitActivator.PI_GIT, mergeStatus.name());
        }
    }
}

From source file:org.nbgit.ui.repository.GitRepositoryUI.java

License:Open Source License

private void repositoryConnectionSelected(Transport rc) {
    url = rc.getURI();
    repositoryPanel.userTextField.setText(url.getUser());
    repositoryPanel.userPasswordField.setText(url.getPass());

    repositoryConnection = rc;/*from   www .  j av a 2 s  .  com*/
}

From source file:org.springframework.cloud.config.server.support.GoogleCloudSourceSupportTests.java

License:Apache License

@SuppressWarnings("SameParameterValue")
private Transport mockSshTransport(String uri) throws URISyntaxException {
    Transport transport = Mockito.mock(SshTransport.class);

    when(transport.getURI()).thenReturn(new URIish(uri));

    return transport;
}