Example usage for org.eclipse.jgit.api Git lsRemoteRepository

List of usage examples for org.eclipse.jgit.api Git lsRemoteRepository

Introduction

In this page you can find the example usage for org.eclipse.jgit.api Git lsRemoteRepository.

Prototype

public static LsRemoteCommand lsRemoteRepository() 

Source Link

Document

Return a command to list remote branches/tags without a local repository.

Usage

From source file:org.gradle.vcs.git.internal.GitVersionControlSystem.java

License:Apache License

private Collection<Ref> getRemoteRefs(GitVersionControlSpec gitSpec, boolean tags, boolean heads) {
    try {//from   w w  w.  j  a  v  a  2  s . c o m
        return Git.lsRemoteRepository().setRemote(normalizeUri(gitSpec.getUrl())).setTags(tags).setHeads(heads)
                .call();
    } catch (URISyntaxException e) {
        throw wrapGitCommandException("ls-remote", gitSpec.getUrl(), null, e);
    } catch (GitAPIException e) {
        throw wrapGitCommandException("ls-remote", gitSpec.getUrl(), null, e);
    }
}

From source file:org.jboss.tools.aerogear.hybrid.engine.internal.cordova.CordovaEngineProvider.java

License:Open Source License

/**
 * Returns a list of all the tags on the Apache repository. This method does not 
 * filter any of the tags. It is up to the clients to filter.
 * /*  w ww  .j a  v a  2  s  . c  o  m*/
 * @return
 * @throws CoreException
 */
public String[] getDownloadableVersions() throws CoreException {
    if (downloadeableVersionsCache.isEmpty()) {
        try {
            Collection<Ref> refs = Git.lsRemoteRepository()
                    .setRemote("https://git-wip-us.apache.org/repos/asf/cordova-ios.git").setHeads(false)
                    .setTags(true).call();
            for (Iterator<Ref> iterator = refs.iterator(); iterator.hasNext();) {
                Ref ref = iterator.next();
                String[] parts = ref.getName().split("/");
                Version v = Version.valueOf(parts[parts.length - 1]);
                if (v.greaterThanOrEqualTo(MIN_VERSION)) {
                    downloadeableVersionsCache.put(v.toString(), ref);
                }
            }
        } catch (GitAPIException e) {
            throw new CoreException(new Status(IStatus.ERROR, HybridCore.PLUGIN_ID,
                    "Unable to retrieve downloadable versions list", e));
        }
    }
    return downloadeableVersionsCache.keySet().toArray(new String[downloadeableVersionsCache.size()]);
}

From source file:org.ossmeter.platform.vcs.git.GitManager.java

License:Open Source License

@Override
public boolean validRepository(VcsRepository repository) throws Exception {

    try {/* ww w  .ja  v  a 2s.c o  m*/
        Git.lsRemoteRepository().setRemote(repository.getUrl()).call();
    } catch (Exception e) {
        return false;
    }

    return true;
}