本文整理了Java中org.eclipse.jgit.api.Git.lsRemote()
方法的一些代码示例,展示了Git.lsRemote()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Git.lsRemote()
方法的具体详情如下:
包路径:org.eclipse.jgit.api.Git
类名称:Git
方法名:lsRemote
[英]Return a command object to execute a ls-remote command
[中]返回命令对象以执行ls远程命令
代码示例来源:origin: centic9/jgit-cookbook
public static void main(String[] args) throws IOException, GitAPIException {
try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
// all refs
try (Git git = new Git(repository)) {
Collection<Ref> refs = git.lsRemote().call();
for (Ref ref : refs) {
System.out.println("Ref: " + ref);
}
// heads only
refs = git.lsRemote().setHeads(true).call();
for (Ref ref : refs) {
System.out.println("Head: " + ref);
}
// tags only
refs = git.lsRemote().setTags(true).call();
for (Ref ref : refs) {
System.out.println("Remote tag: " + ref);
}
}
}
}
}
代码示例来源:origin: centic9/jgit-cookbook
public static void main(String[] args) throws IOException, GitAPIException {
try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
// all refs
try (Git git = new Git(repository)) {
Collection<Ref> refs = git.lsRemote().call();
for (Ref ref : refs) {
System.out.println("Ref: " + ref);
}
// heads only
refs = git.lsRemote().setHeads(true).call();
for (Ref ref : refs) {
System.out.println("Head: " + ref);
}
// tags only
refs = git.lsRemote().setTags(true).call();
for (Ref ref : refs) {
System.out.println("Remote tag: " + ref);
}
}
}
}
}
代码示例来源:origin: org.walkmod/junit4git
protected boolean areNotesInRemote(Git git) throws GitAPIException {
try {
return git.lsRemote().call().stream()
.filter(remoteRef -> remoteRef.getName().equals(GIT_NOTES_REF))
.findFirst()
.isPresent();
} catch (TransportException e) {
return false;
}
}
代码示例来源:origin: org.apache.stratos/org.apache.stratos.adc.mgt
LsRemoteCommand cmd = git.lsRemote().setRemote(repoURL);
if (credentialsProvider != null) {
cmd.setCredentialsProvider(credentialsProvider);
代码示例来源:origin: danielflower/multi-module-maven-release-plugin
@Override
public Collection<Ref> getTags() throws GitAPIException {
LsRemoteCommand lsRemoteCommand = git.lsRemote()
.setTags(true).setHeads(false)
.setCredentialsProvider(credentialsProvider);
if (remoteUrl != null) {
lsRemoteCommand.setRemote(remoteUrl);
}
return lsRemoteCommand.call();
}
代码示例来源:origin: io.fabric8/fabric-git
for (Ref ref : git.lsRemote().setCredentialsProvider(credentialsProvider).setTags(false).setRemote(remoteRef).setHeads(true).call()) {
if (ref.getName().startsWith("refs/heads/")) {
String name = ref.getName().substring(("refs/heads/").length());
代码示例来源:origin: jboss-fuse/fabric8
for (Ref ref : git.lsRemote().setTimeout(timeoutInSeconds).setCredentialsProvider(credentialsProvider)
.setTags(false)
.setHeads(true)
代码示例来源:origin: org.apache.maven.scm/maven-scm-provider-jgit
git.lsRemote().setRemote( repo.getPushUrl() ).setCredentialsProvider( credentials );
代码示例来源:origin: org.apache.maven.scm/maven-scm-provider-jgit
Collection<Ref> lsResult = git.lsRemote().setCredentialsProvider( credentials ).call();
for ( Ref ref : lsResult )
代码示例来源:origin: apache/maven-scm
git.lsRemote().setRemote( repo.getPushUrl() ).setCredentialsProvider( credentials )
.setTransportConfigCallback(new JGitTransportConfigCallback(repo, getLogger()));
代码示例来源:origin: apache/maven-scm
Collection<Ref> lsResult = git.lsRemote().setCredentialsProvider( credentials )
.setTransportConfigCallback(
new JGitTransportConfigCallback((GitScmProviderRepository) repo, getLogger()))
内容来源于网络,如有侵权,请联系作者删除!