当前位置: 首页>>代码示例>>Java>>正文


Java RepositoryId.createFromId方法代码示例

本文整理汇总了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();
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:25,代码来源:MylynGitHubApi.java

示例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;
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:21,代码来源:MylynGitHubApi.java

示例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();
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:18,代码来源:LoginController.java

示例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;
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:29,代码来源:SearchRepositoryListFragment.java

示例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;
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:38,代码来源:MylynGitHubApi.java

示例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;
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:37,代码来源:MylynGitHubApi.java

示例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);
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:11,代码来源:Preferences.java

示例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());
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:6,代码来源:Utility.java


注:本文中的org.eclipse.egit.github.core.RepositoryId.createFromId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。