本文整理汇总了Java中org.eclipse.egit.github.core.RepositoryId.createFromId方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryId.createFromId方法的具体用法?Java RepositoryId.createFromId怎么用?Java RepositoryId.createFromId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.egit.github.core.RepositoryId
的用法示例。
在下文中一共展示了RepositoryId.createFromId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getShaForPullRequest
import org.eclipse.egit.github.core.RepositoryId; //导入方法依赖的package包/类
@SneakyThrows
public String getShaForPullRequest(PullRequestStatus commitStatus) {
String repositoryId = commitStatus.getRepoId();
int pullRequestId = commitStatus.getPullRequestId();
String currentUserGitHubLogin = commitStatus.getGitHubUsername();
String accessToken = commitStatus.getAccessToken();
if (accessToken == null) {
return null;
}
GitHubClient client = createClient(accessToken);
RepositoryId id = RepositoryId.createFromId(repositoryId);
PullRequestService service = new PullRequestService(client);
PullRequest pullRequest = service.getPullRequest(id, pullRequestId);
String githubLoginForContributor = pullRequest.getUser().getLogin();
if(commitStatus.isAdmin()) {
commitStatus.setGitHubUsername(githubLoginForContributor);
}else if (!githubLoginForContributor.equals(currentUserGitHubLogin)) {
return null;
}
return pullRequest.getHead().getSha();
}
示例2: findAssociatedClaNames
import org.eclipse.egit.github.core.RepositoryId; //导入方法依赖的package包/类
@Override
@SneakyThrows
public Set<String> findAssociatedClaNames(String repoId, String accessToken) {
GitHubClient client = createClient(accessToken);
RepositoryService service = new RepositoryService(client);
RepositoryId repositoryId = RepositoryId.createFromId(repoId);
List<RepositoryHook> hooks = service.getHooks(repositoryId);
Set<String> claNames = hooks.stream() //
.filter(h -> StringUtils.hasText(h.getConfig().get("url"))) //
.filter(RepositoryHook::isActive) //
.map(h -> h.getConfig().get("url")) //
.filter(PULL_REQUEST_CALLBACK_PATTERN.asPredicate()) //
.map(url -> getClaName(url, PULL_REQUEST_CALLBACK_PATTERN)) //
.collect(Collectors.toSet());
return claNames;
}
示例3: getPreviousLoginDetails
import org.eclipse.egit.github.core.RepositoryId; //导入方法依赖的package包/类
public void getPreviousLoginDetails() {
Optional<RepositoryId> lastViewedRepository = logic.prefs.getLastViewedRepository();
TreeSet<String> storedRepos = new TreeSet<>(logic.getStoredRepos());
if (lastViewedRepository.isPresent() &&
storedRepos.contains(RepositoryId.create(
lastViewedRepository.get().getOwner(),
lastViewedRepository.get().getName()).generateId())) {
owner = lastViewedRepository.get().getOwner();
repo = lastViewedRepository.get().getName();
} else if (!storedRepos.isEmpty()) {
RepositoryId repositoryId = RepositoryId.createFromId(storedRepos.first());
owner = repositoryId.getOwner();
repo = repositoryId.getName();
}
username = logic.prefs.getLastLoginUsername();
password = logic.prefs.getLastLoginPassword();
}
示例4: openRepositoryMatch
import org.eclipse.egit.github.core.RepositoryId; //导入方法依赖的package包/类
/**
* Check if the search query is an exact repository name/owner match and
* open the repository activity and finish the current activity when it is
*
* @param query
* @return true if query opened as repository, false otherwise
*/
private boolean openRepositoryMatch(final String query) {
if (TextUtils.isEmpty(query))
return false;
RepositoryId repoId = RepositoryId.createFromId(query.trim());
if (repoId == null)
return false;
Repository repo;
try {
repo = service.getRepository(repoId);
} catch (IOException e) {
return false;
}
startActivity(RepositoryViewActivity.createIntent(repo));
final Activity activity = getActivity();
if (activity != null)
activity.finish();
return true;
}
示例5: createUpdatePullRequestStatuses
import org.eclipse.egit.github.core.RepositoryId; //导入方法依赖的package包/类
@Override
@SneakyThrows
public List<PullRequestStatus> createUpdatePullRequestStatuses(
MigratePullRequestStatusRequest request) {
GitHubClient client = createClient(request.getAccessToken());
PullRequestService pullRequestService = new PullRequestService(client);
String commitStatusUrl = request.getCommitStatusUrl();
String accessToken = request.getAccessToken();
List<PullRequestStatus> results = new ArrayList<>();
for(String repositoryId : request.getRepositoryIds()) {
RepositoryId repository = RepositoryId.createFromId(repositoryId);
List<PullRequest> repositoryPullRequests = pullRequestService.getPullRequests(repository, "open");
for(PullRequest pullRequest : repositoryPullRequests) {
PullRequestStatus status = new PullRequestStatus();
String sha = pullRequest.getHead().getSha();
String syncUrl = UriComponentsBuilder.fromHttpUrl(request.getBaseSyncUrl())
.queryParam("repositoryId", repositoryId)
.queryParam("pullRequestId", pullRequest.getNumber())
.build()
.toUriString();
status.setPullRequestId(pullRequest.getNumber());
status.setRepoId(repositoryId);
status.setSha(sha);
status.setGitHubUsername(pullRequest.getUser().getLogin());
status.setUrl(commitStatusUrl);
status.setAccessToken(accessToken);
status.setFaqUrl(request.getFaqUrl());
status.setSyncUrl(syncUrl);
status.setPullRequestState(pullRequest.getState());
results.add(status);
}
}
return results;
}
示例6: createPullRequestHooks
import org.eclipse.egit.github.core.RepositoryId; //导入方法依赖的package包/类
@Override
@SneakyThrows
public List<String> createPullRequestHooks(CreatePullRequestHookRequest request)
{
String accessToken = request.getAccessToken();
List<String> repositoryIds = request.getRepositoryIds();
String gitHubEventUrl = request.getGitHubEventUrl();
GitHubClient client = createClient(accessToken);
RepositoryService service = new RepositoryService(client);
List<String> hookUrls = new ArrayList<>();
for (String repository : repositoryIds) {
RepositoryId repositoryId = RepositoryId.createFromId(repository);
EventsRepositoryHook hook = createHook(gitHubEventUrl, request.getSecret());
List<RepositoryHook> hooks = service.getHooks(repositoryId);
Optional<RepositoryHook> optional = hooks.stream().filter(h -> hasUrl(h, gitHubEventUrl)).findFirst();
long hookId;
if (optional.isPresent()) {
// we must always update because the secret is not exposed
hook.setId(optional.get().getId());
hook.setActive(true);
RepositoryHook editHook = service.editHook(repositoryId, hook);
hookId = editHook.getId();
} else {
RepositoryHook createdHook = service.createHook(repositoryId, hook);
hookId = createdHook.getId();
}
hookUrls.add("https://github.com/" + repository + "/settings/hooks/" + hookId);
}
return hookUrls;
}
示例7: getLastViewedRepository
import org.eclipse.egit.github.core.RepositoryId; //导入方法依赖的package包/类
public Optional<RepositoryId> getLastViewedRepository() {
if (sessionConfig.getLastViewedRepository().isEmpty()) {
return Optional.empty();
}
RepositoryId repositoryId = RepositoryId.createFromId(sessionConfig.getLastViewedRepository());
if (repositoryId == null) {
return Optional.empty();
}
return Optional.of(repositoryId);
}
示例8: isWellFormedRepoId
import org.eclipse.egit.github.core.RepositoryId; //导入方法依赖的package包/类
public static boolean isWellFormedRepoId(String repoId) {
RepositoryId repositoryId = RepositoryId.createFromId(repoId);
return repoId != null && !repoId.isEmpty() && repositoryId != null
&& repoId.equals(repositoryId.generateId());
}