本文整理汇总了Java中org.eclipse.egit.github.core.Repository.setOwner方法的典型用法代码示例。如果您正苦于以下问题:Java Repository.setOwner方法的具体用法?Java Repository.setOwner怎么用?Java Repository.setOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.egit.github.core.Repository
的用法示例。
在下文中一共展示了Repository.setOwner方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRepoForOrg
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
* Create a repository for a given organization with a description
*
* @param org
* @param repoName
* @param description
* @return RepoItem bean/json object
* @throws KaramelException
*/
public synchronized static RepoItem createRepoForOrg(String org, String repoName, String description) throws
KaramelException {
try {
OrganizationService os = new OrganizationService(client);
RepositoryService rs = new RepositoryService(client);
Repository r = new Repository();
r.setName(repoName);
r.setOwner(os.getOrganization(org));
r.setDescription(description);
rs.createRepository(org, r);
cloneRepo(org, repoName);
cachedRepos.remove(org);
return new RepoItem(repoName, description, r.getSshUrl());
} catch (IOException ex) {
throw new KaramelException("Problem creating the repository " + repoName + " for organization " + org
+ " : " + ex.getMessage());
}
}
示例2: createRepoForUser
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
* Create a repository in a given github user's local account.
*
* @param repoName
* @param description
* @throws KaramelException
*/
public synchronized static void createRepoForUser(String repoName, String description) throws KaramelException {
try {
UserService us = new UserService(client);
RepositoryService rs = new RepositoryService(client);
Repository r = new Repository();
r.setName(repoName);
r.setOwner(us.getUser());
r.setDescription(description);
rs.createRepository(r);
cloneRepo(getUser(), repoName);
cachedRepos.remove(GithubApi.getUser());
} catch (IOException ex) {
throw new KaramelException("Problem creating " + repoName + " for user " + ex.getMessage());
}
}
示例3: loadFrom
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
@Override
public Repository loadFrom(Cursor cursor) {
Repository repo = new Repository();
repo.setId(cursor.getLong(0));
repo.setName(cursor.getString(1));
User owner = new User();
owner.setId(cursor.getInt(2));
owner.setLogin(cursor.getString(3));
owner.setAvatarUrl(cursor.getString(4));
repo.setOwner(owner);
repo.setPrivate(cursor.getInt(5) == 1);
repo.setFork(cursor.getInt(6) == 1);
repo.setDescription(cursor.getString(7));
repo.setForks(cursor.getInt(8));
repo.setWatchers(cursor.getInt(9));
repo.setLanguage(cursor.getString(10));
repo.setHasIssues(cursor.getInt(11) == 1);
repo.setMirrorUrl(cursor.getString(12));
return repo;
}
示例4: getRepository
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
* Get {@link Repository} from {@link EventRepository} and actor
*
* @param repo
* @param actor
* @param org
* @return possibly null repository
*/
public static Repository getRepository(final EventRepository repo,
User actor, User org) {
if (repo == null)
return null;
String id = repo.getName();
int slash = id.indexOf('/');
if (slash == -1 || slash + 1 >= id.length())
return null;
Repository full = new Repository();
full.setId(repo.getId());
full.setName(id.substring(slash + 1));
String login = id.substring(0, slash);
// Use actor if it matches login parsed from repository id
if (actor != null && login.equals(actor.getLogin()))
full.setOwner(actor);
else if (org != null && login.equals(org.getLogin()))
full.setOwner(org);
else
full.setOwner(new User().setLogin(id.substring(0, slash)));
return full;
}
示例5: getRepository
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
* Attempt to parse a {@link Repository} from the given {@link Uri}
*
* @param uri
* @return {@link Repository} or null if unparseable
*/
public static Repository getRepository(Uri uri) {
List<String> segments = uri.getPathSegments();
if (segments == null)
return null;
if (segments.size() != 2)
return null;
String repoOwner = segments.get(0);
if (!RepositoryUtils.isValidOwner(repoOwner))
return null;
String repoName = segments.get(1);
if (TextUtils.isEmpty(repoName))
return null;
Repository repository = new Repository();
repository.setName(repoName);
repository.setOwner(new User().setLogin(repoOwner));
return repository;
}
示例6: viewRepository
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
@Override
protected void viewRepository(Repository repository) {
User owner = repository.getOwner();
if (owner != null && org.getLogin().equals(owner.getLogin()))
repository.setOwner(org);
super.viewRepository(repository);
}
示例7: getCommit
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
* Attempt to parse a {@link CommitMatch} from the given {@link Uri}
*
* @param uri
* @return {@link CommitMatch} or null if unparseable
*/
public static CommitMatch getCommit(Uri uri) {
List<String> segments = uri.getPathSegments();
if (segments == null)
return null;
if (segments.size() != 4)
return null;
if (!"commit".equals(segments.get(2)))
return null;
String repoOwner = segments.get(0);
if (!RepositoryUtils.isValidOwner(repoOwner))
return null;
String repoName = segments.get(1);
if (TextUtils.isEmpty(repoName))
return null;
String commit = segments.get(3);
if (!CommitUtils.isValidCommit(commit))
return null;
Repository repository = new Repository();
repository.setName(repoName);
repository.setOwner(new User().setLogin(repoOwner));
return new CommitMatch(repository, commit);
}
示例8: getCommit
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
* Get commit match from URL
*
* @param url
* @return commit match or null if the given URL wasn't a match
*/
public CommitMatch getCommit(final String url) {
if (!isMatch(url, matcher))
return null;
String owner = matcher.group(1);
String name = matcher.group(2);
String sha = matcher.group(3);
Repository repo = new Repository();
repo.setName(name);
repo.setOwner(new User().setLogin(owner));
return new CommitMatch(repo, sha);
}
示例9: getIssue
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
* Parse a {@link RepositoryIssue} from a non-null {@link Uri}
*
* @param uri
* @return {@link RepositoryIssue} or null if none found in given
* {@link Uri}
*/
public static RepositoryIssue getIssue(Uri uri) {
List<String> segments = uri.getPathSegments();
if (segments == null)
return null;
if (segments.size() < 4)
return null;
if (!"issues".equals(segments.get(2))
&& !"pull".equals(segments.get(2)))
return null;
String repoOwner = segments.get(0);
if (TextUtils.isEmpty(repoOwner))
return null;
String repoName = segments.get(1);
if (TextUtils.isEmpty(repoName))
return null;
String number = segments.get(3);
if (TextUtils.isEmpty(number))
return null;
int issueNumber;
try {
issueNumber = Integer.parseInt(number);
} catch (NumberFormatException nfe) {
return null;
}
if (issueNumber < 1)
return null;
Repository repo = new Repository();
repo.setName(repoName);
repo.setOwner(new User().setLogin(repoOwner));
RepositoryIssue issue = new RepositoryIssue();
issue.setRepository(repo);
issue.setNumber(issueNumber);
return issue;
}
示例10: mockPR
import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
private PullRequest mockPR() {
final PullRequest pr = new PullRequest();
final PullRequestMarker head = new PullRequestMarker();
final User owner = new User();
owner.setLogin("user");
final Repository repo = new Repository();
repo.setName("repo");
repo.setOwner(owner);
head.setRepo(repo);
pr.setHead(head);
head.setRef("feature/my-branch");
pr.setNumber(1);
return pr;
}