本文整理匯總了Java中org.eclipse.jgit.transport.URIish.isRemote方法的典型用法代碼示例。如果您正苦於以下問題:Java URIish.isRemote方法的具體用法?Java URIish.isRemote怎麽用?Java URIish.isRemote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jgit.transport.URIish
的用法示例。
在下文中一共展示了URIish.isRemote方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createProject
import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
private boolean createProject(URIish replicateURI, Project.NameKey projectName, String head) {
if (isGerrit(replicateURI)) {
gerritAdmin.createProject(replicateURI, projectName, head);
} else if (!replicateURI.isRemote()) {
createLocally(replicateURI, head);
repLog.info("Created local repository: " + replicateURI);
} else if (isSSH(replicateURI)) {
createRemoteSsh(replicateURI, head);
repLog.info("Created remote repository: " + replicateURI);
} else {
repLog.warn(
String.format(
"Cannot create new project on remote site %s."
+ " Only local paths and SSH URLs are supported"
+ " for remote repository creation",
replicateURI));
return false;
}
return true;
}
示例2: deleteProject
import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
private void deleteProject(URIish replicateURI, Project.NameKey projectName) {
if (isGerrit(replicateURI)) {
gerritAdmin.deleteProject(replicateURI, projectName);
repLog.info("Deleted remote repository: " + replicateURI);
} else if (!replicateURI.isRemote()) {
deleteLocally(replicateURI);
repLog.info("Deleted local repository: " + replicateURI);
} else if (isSSH(replicateURI)) {
deleteRemoteSsh(replicateURI);
repLog.info("Deleted remote repository: " + replicateURI);
} else {
repLog.warn(
String.format(
"Cannot delete project on remote site %s."
+ " Only local paths and SSH URLs are supported"
+ " for remote repository deletion",
replicateURI));
}
}
示例3: updateHead
import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
private void updateHead(URIish replicateURI, Project.NameKey projectName, String newHead) {
if (isGerrit(replicateURI)) {
gerritAdmin.updateHead(replicateURI, projectName, newHead);
} else if (!replicateURI.isRemote()) {
updateHeadLocally(replicateURI, newHead);
} else if (isSSH(replicateURI)) {
updateHeadRemoteSsh(replicateURI, newHead);
} else {
repLog.warn(
String.format(
"Cannot update HEAD of project on remote site %s."
+ " Only local paths and SSH URLs are supported"
+ " for remote HEAD update.",
replicateURI));
}
}
示例4: isSSH
import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
private static boolean isSSH(URIish uri) {
String scheme = uri.getScheme();
if (!uri.isRemote()) {
return false;
}
if (scheme != null && scheme.toLowerCase().contains("ssh")) {
return true;
}
if (scheme == null && uri.getHost() != null && uri.getPath() != null) {
return true;
}
return false;
}
示例5: resolveNodeName
import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
static String resolveNodeName(URIish uri) {
StringBuilder sb = new StringBuilder();
if (uri.isRemote()) {
sb.append(uri.getHost());
if (uri.getPort() != -1) {
sb.append(":");
sb.append(uri.getPort());
}
} else {
sb.append(uri.getPath());
}
return sb.toString();
}
示例6: load
import org.eclipse.jgit.transport.URIish; //導入方法依賴的package包/類
public boolean load(File repoFile) {
Repository repository;
Git git = null;
try {
repository = new FileRepositoryBuilder().setGitDir(repoFile)
.setMustExist(true)
.readEnvironment()
.build();
git = new Git(repository);
branchFull = repository.getFullBranch();
branchShort = repository.getBranch();
state = repository.getRepositoryState().getDescription();
for (Ref branch : git.branchList().call()) {
if (branch.getName().equals(branchFull)) {
BranchTrackingStatus bts = BranchTrackingStatus.of(repository, branchFull);
if (bts != null) {
RemoteConfig rc = new RemoteConfig(repository.getConfig(), repository.getRemoteName(bts.getRemoteTrackingBranch()));
for (URIish uri : rc.getURIs()) {
if (uri.isRemote() && uri.getHost().toLowerCase().equals("github.com")) {
remote = new GitInformationRemote();
remote.branch = bts.getRemoteTrackingBranch();
remote.uri = uri.toString();
remote.link = "http://" + uri.getHost() + uri.getPath().replace(".git", "");
remote.name = uri.getHumanishName();
remote.ahead = bts.getAheadCount();
remote.behind = bts.getBehindCount();
}
}
}
commits = loadCommits(repository, git, branch);
}
}
git.close();
} catch (IOException | GitAPIException | URISyntaxException e) {
e.printStackTrace();
isRepository = false;
if (git != null) git.close();
return false;
}
isRepository = true;
return true;
}