• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RepositoryCommit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.egit.github.core.RepositoryCommit的典型用法代码示例。如果您正苦于以下问题:Java RepositoryCommit类的具体用法?Java RepositoryCommit怎么用?Java RepositoryCommit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RepositoryCommit类属于org.eclipse.egit.github.core包,在下文中一共展示了RepositoryCommit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: importCommits

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
public void importCommits(ProjectEvent projectEvent) throws IOException {
    Project project = projectService.getProject(projectEvent.getProjectId());
    Assert.notNull(project, "Could not find project with the provided id");

    // Get GitHub repository commits
    RepositoryId repositoryId = new RepositoryId(project.getOwner(), project.getName());
    List<RepositoryCommit> repositoryCommits = gitTemplate.commitService().getCommits(repositoryId);

    Flux<Commit> commits;

    commits = Flux.fromStream(repositoryCommits.stream()).map(c -> {
        try {
            log.info("Importing commit: " + repositoryId.getName() + " -> " + c.getSha());
            return gitTemplate.commitService().getCommit(repositoryId, c.getSha());
        } catch (IOException e) {
            throw new RuntimeException("Could not get commit", e);
        }
    }).filter(a -> a.getFiles() != null && a.getFiles().size() < 10)
            .map(a -> new Commit(a.getFiles().stream()
                    .map(f -> new File(f.getFilename())).collect(Collectors.toList()),
                    a.getCommit().getCommitter().getName(),
                    a.getCommit().getCommitter().getDate().getTime()))
            .sort(Comparator.comparing(Commit::getCommitDate));

    commits.subscribe(commit -> saveCommits(project, commit));
}
 
开发者ID:kbastani,项目名称:service-block-samples,代码行数:27,代码来源:CommitProcessor.java


示例2: poll

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Override
protected int poll() throws Exception {
    List<RepositoryCommit> commits = commitService.getCommits(getRepository());
    // In the end, we want tags oldest to newest.
    Stack<RepositoryCommit> newCommits = new Stack<RepositoryCommit>();
    for (RepositoryCommit commit : commits) {
        if (!commitHashes.contains(commit.getSha())) {
            newCommits.push(commit);
            commitHashes.add(commit.getSha());
        }
    }
    
    while (!newCommits.empty()) {
        RepositoryCommit newCommit = newCommits.pop();
        Exchange e = getEndpoint().createExchange();
        e.getIn().setBody(newCommit);
        getProcessor().process(e);
    }
    return newCommits.size();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:CommitConsumer.java


示例3: getFileDetails

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Override
public ChangesetFileDetailsEnvelope getFileDetails(Repository repository, Changeset changeset)
{
    CommitService commitService = githubClientProvider.getCommitService(repository);
    RepositoryId repositoryId = RepositoryId.create(repository.getOrgName(), repository.getSlug());

    // Workaround for BBC-455
    checkRequestRateLimit(commitService.getClient());
    try
    {
        RepositoryCommit commit = commitService.getCommit(repositoryId, changeset.getNode());

        return new ChangesetFileDetailsEnvelope(GithubChangesetFactory.transformToFileDetails(commit.getFiles()), commit.getFiles().size());
    }
    catch (IOException e)
    {
        throw new SourceControlException("could not get result", e);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:GithubCommunicator.java


示例4: gettingDetailChangeset_ShouldSendGETRequestToGithub_AndParseJsonResult

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Test
public void gettingDetailChangeset_ShouldSendGETRequestToGithub_AndParseJsonResult()
        throws ResponseException, IOException
{
    when(repository.getSlug()).thenReturn("SLUG");
    when(repository.getOrgName()).thenReturn("ORG");

    RepositoryCommit repositoryCommit = mock(RepositoryCommit.class);
    when(commitService.getCommit(Matchers.<IRepositoryIdProvider>anyObject(), anyString())).thenReturn(repositoryCommit);
    Commit commit = mock(Commit.class);
    when(repositoryCommit.getCommit()).thenReturn(commit);
    when(commit.getMessage()).thenReturn("ABC-123 fix");

    Changeset detailChangeset = communicator.getChangeset(repository, "abcde");

    verify(commitService).getCommit(Matchers.<IRepositoryIdProvider>anyObject(), anyString());

    assertThat(detailChangeset.getMessage()).isEqualTo("ABC-123 fix");
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:GithubCommunicatorTest.java


示例5: testCommit

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Test
public void testCommit() throws IOException
{
    when(repositoryPullRequestDao.findRequestByRemoteId(eq(repository), anyLong())).thenReturn(null);

    RepositoryCommit repositoryCommit = mockCommit("aaa");
    when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));
    final String issueKey = "TST-1";
    final ImmutableSet<String> issueKeys = ImmutableSet.of(issueKey);
    when(repositoryPullRequestDao.getIssueKeys(anyInt(), anyInt())).thenReturn(issueKeys);

    testedClass.processPullRequest(repository, pullRequest);
    verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());

    assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");
    ArgumentCaptor<Object> eventCaptor = ArgumentCaptor.forClass(Object.class);
    verify(notificationService, times(1)).broadcast(eventCaptor.capture());

    DevSummaryChangedEvent firstEvent = (DevSummaryChangedEvent) eventCaptor.getValue();
    assertThat(firstEvent.getIssueKeys(), contains(new String[] { issueKey }));
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:GitHubPullRequestProcessorTest.java


示例6: testUpdateCommits

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Test
public void testUpdateCommits() throws IOException
{
    when(repositoryPullRequestDao.findRequestByRemoteId(eq(repository), anyLong())).thenReturn(null);

    RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
    when(commitMapping.getNode()).thenReturn("original");
    when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
    target.setCommits(new RepositoryCommitMapping[] { commitMapping });

    RepositoryCommit repositoryCommit = mockCommit("aaa");
    when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));

    testedClass.processPullRequest(repository, pullRequest);
    verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());
    assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");

    verify(repositoryPullRequestDao).unlinkCommits(eq(repository), eq(target), argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
    verify(repositoryPullRequestDao).removeCommits(argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
    verify(notificationService, times(1)).broadcast(anyObject());
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:GitHubPullRequestProcessorTest.java


示例7: testUpdateCommitNoChange

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Test
public void testUpdateCommitNoChange() throws IOException
{
    RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
    when(commitMapping.getNode()).thenReturn("original");
    when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
    target.setCommits(new RepositoryCommitMapping[] { commitMapping });

    RepositoryCommit repositoryCommit = mockCommit("aaa");
    when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));

    testedClass.processPullRequest(repository, pullRequest);
    verify(repositoryPullRequestDao, never()).saveCommit(eq(repository), anyMap());

    verify(repositoryPullRequestDao, never()).unlinkCommits(eq(repository), eq(pullRequestMapping), any(Iterable.class));
    verify(repositoryPullRequestDao, never()).removeCommits(any(Iterable.class));
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:18,代码来源:GitHubPullRequestProcessorTest.java


示例8: testUpdateCommitRetargeted

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Test
public void testUpdateCommitRetargeted() throws IOException
{
    final PullRequestMarker destination = mockRef("destinationBranch2");
    when(pullRequest.getBase()).thenReturn(destination);

    RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
    when(commitMapping.getNode()).thenReturn("original");
    when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
    target.setCommits(new RepositoryCommitMapping[] { commitMapping });

    RepositoryCommit repositoryCommit = mockCommit("aaa");
    when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));

    testedClass.processPullRequest(repository, pullRequest);
    verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());
    assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");

    verify(repositoryPullRequestDao).unlinkCommits(eq(repository), eq(target), argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
    verify(repositoryPullRequestDao).removeCommits(argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:GitHubPullRequestProcessorTest.java


示例9: testUpdateCommitStatusChanged

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Test
public void testUpdateCommitStatusChanged() throws IOException
{
    when(pullRequest.getState()).thenReturn("closed");

    RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
    when(commitMapping.getNode()).thenReturn("original");
    when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
    target.setCommits(new RepositoryCommitMapping[] { commitMapping });

    RepositoryCommit repositoryCommit = mockCommit("aaa");
    when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));

    testedClass.processPullRequest(repository, pullRequest);
    verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());
    assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");

    verify(repositoryPullRequestDao).unlinkCommits(eq(repository), eq(target), argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
    verify(repositoryPullRequestDao).removeCommits(argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:21,代码来源:GitHubPullRequestProcessorTest.java


示例10: openCommit

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
private void openCommit(final RepositoryCommit commit) {
    if (compare != null) {
        int commitPosition = 0;
        Collection<RepositoryCommit> commits = compare.getCommits();
        for (RepositoryCommit candidate : commits)
            if (commit == candidate)
                break;
            else
                commitPosition++;
        if (commitPosition < commits.size())
            startActivity(CommitViewActivity.createIntent(repository,
                    commitPosition, commits));
    } else
        startActivity(CommitViewActivity.createIntent(repository,
                commit.getSha()));
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:17,代码来源:CommitCompareListFragment.java


示例11: onCreateLoader

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Override
public Loader<List<RepositoryCommit>> onCreateLoader(int id, Bundle bundle) {
    final ThrowableLoader<List<RepositoryCommit>> parentLoader = (ThrowableLoader<List<RepositoryCommit>>) super
            .onCreateLoader(id, bundle);
    return new ThrowableLoader<List<RepositoryCommit>>(getActivity(), items) {

        @Override
        public List<RepositoryCommit> loadData() throws Exception {
            if (TextUtils.isEmpty(ref)) {
                String defaultBranch = repository.getMasterBranch();
                if (TextUtils.isEmpty(defaultBranch)) {
                    defaultBranch = repoService.getRepository(repository)
                            .getMasterBranch();
                    if (TextUtils.isEmpty(defaultBranch))
                        defaultBranch = "master";
                }
                ref = defaultBranch;
            }

            return parentLoader.loadData();
        }
    };
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:24,代码来源:CommitListFragment.java


示例12: addCommit

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
/**
 * Add commit to store
 *
 * @param repo
 * @param commit
 * @return commit
 */
public RepositoryCommit addCommit(IRepositoryIdProvider repo,
        RepositoryCommit commit) {
    RepositoryCommit current = getCommit(repo, commit.getSha());
    if (current != null) {
        current.setAuthor(commit.getAuthor());
        current.setCommit(commit.getCommit());
        current.setCommitter(commit.getCommitter());
        current.setFiles(commit.getFiles());
        current.setParents(commit.getParents());
        current.setSha(commit.getSha());
        current.setStats(commit.getStats());
        current.setUrl(commit.getUrl());
        return current;
    } else {
        String repoId = repo.generateId();
        ItemReferences<RepositoryCommit> repoCommits = commits.get(repoId);
        if (repoCommits == null) {
            repoCommits = new ItemReferences<RepositoryCommit>();
            commits.put(repoId, repoCommits);
        }
        repoCommits.put(commit.getSha(), commit);
        return commit;
    }
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:32,代码来源:CommitStore.java


示例13: run

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Override
protected FullCommit run(Account account) throws Exception {
    RepositoryCommit commit = store.refreshCommit(repository, id);
    Commit rawCommit = commit.getCommit();
    if (rawCommit != null && rawCommit.getCommentCount() > 0) {
        List<CommitComment> comments = service.getComments(repository,
                commit.getSha());
        for (CommitComment comment : comments) {
            String formatted = HtmlUtils.format(comment.getBodyHtml())
                    .toString();
            comment.setBodyHtml(formatted);
            imageGetter.encode(comment, formatted);
        }
        return new FullCommit(commit, comments);
    } else
        return new FullCommit(commit);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:RefreshCommitTask.java


示例14: pageCommits

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
/**
 * Page commits in given repository
 *
 * @param repository
 * @param sha
 * @param path
 * @param size
 * @return page iterator
 */
public PageIterator<RepositoryCommit> pageCommits(
		IRepositoryIdProvider repository, String sha, String path, int size) {
	String id = getId(repository);
	StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
	uri.append('/').append(id);
	uri.append(SEGMENT_COMMITS);
	PagedRequest<RepositoryCommit> request = createPagedRequest(PAGE_FIRST,
			size);
	request.setUri(uri);
	request.setType(new TypeToken<List<RepositoryCommit>>() {
	}.getType());

	if (sha != null || path != null) {
		Map<String, String> params = new HashMap<String, String>();
		if (sha != null)
			params.put("sha", sha); //$NON-NLS-1$
		if (path != null)
			params.put("path", path); //$NON-NLS-1$
		request.setParams(params);
	}

	return createPageIterator(request);
}
 
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:33,代码来源:CommitService.java


示例15: getCommit

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
/**
 * Get commit with given SHA-1 from given repository
 *
 * @param repository
 * @param sha
 * @return repository commit
 * @throws IOException
 */
public RepositoryCommit getCommit(IRepositoryIdProvider repository,
		String sha) throws IOException {
	String id = getId(repository);
	if (sha == null)
		throw new IllegalArgumentException("Sha cannot be null"); //$NON-NLS-1$
	if (sha.length() == 0)
		throw new IllegalArgumentException("Sha cannot be empty"); //$NON-NLS-1$

	StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
	uri.append('/').append(id);
	uri.append(SEGMENT_COMMITS);
	uri.append('/').append(sha);
	GitHubRequest request = createRequest();
	request.setUri(uri);
	request.setType(RepositoryCommit.class);
	return (RepositoryCommit) client.get(request).getBody();
}
 
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:26,代码来源:CommitService.java


示例16: fetchFromGitHub

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
/**
 * Builds commits from GitHub.
 *
 * @return run to commit map
 * @throws IOException when the map cannot be created
 */
private HashMap<Integer, RepositoryCommit> fetchFromGitHub() throws IOException {
	HashMap<Integer, RepositoryCommit> map = new HashMap<>();
	int numberOfRuns = props.getInteger(COMMIT_COUNT);
	log.debug("Looking for last {} commits on github", numberOfRuns);

	final String oAuth2Token = props.getString(GITHUB_OAUTH_TOKEN);
	final String branch = props.getString(GITHUB_BRANCH);
	final String gitHubOwner = props.getString(GITHUB_OWNER);
	final String gitHubRepo = props.getString(GITHUB_REPOSITORY);

	final List<RepositoryCommit> commits = getCommitsFromGitHub(oAuth2Token, gitHubOwner, gitHubRepo, branch);

	for (RepositoryCommit commit : commits) {
		if (numberOfRuns <= 0) {
			break;
		}

		map.put(--numberOfRuns, commit);
	}

	return map;
}
 
开发者ID:ever-been,项目名称:benchmark-hazelcast3,代码行数:29,代码来源:HazelcastBenchmark.java


示例17: getCommitsFromGitHub

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
/**
 * Fetches list of commits form GitHub repository.
 *
 * @param auth
 * @param owner
 * @param name
 * @param branch
 * @return list of commits
 * @throws IOException
 */
private List<RepositoryCommit> getCommitsFromGitHub(final String auth, final String owner, final String name,
													final String branch) throws IOException {
	GitHubClient client = new GitHubClient();

	if (auth != null && !auth.isEmpty()) {
		client.setOAuth2Token(auth);
	} else {
		log.warn("OAuth2Token not set");
	}

	CommitService cs = new CommitService(client);

	RepositoryService rs = new RepositoryService(client);
	final Repository repository = rs.getRepository(owner, name);

	return cs.getCommits(repository, branch, null);

}
 
开发者ID:ever-been,项目名称:benchmark-hazelcast3,代码行数:29,代码来源:HazelcastBenchmark.java


示例18: CommitGroovyObject

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
CommitGroovyObject(final RepositoryCommit commit,
                   final ExtendedCommitService commitService,
                   final RepositoryId base) {
    this.commit = commit;
    this.commitService = commitService;
    this.base = base;
}
 
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:8,代码来源:CommitGroovyObject.java


示例19: commitConsumerTest

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Test
public void commitConsumerTest() throws Exception {
    mockResultEndpoint.expectedMessageCount(2);
    RepositoryCommit commit1 = commitService.addRepositoryCommit();
    RepositoryCommit commit2 = commitService.addRepositoryCommit();
    mockResultEndpoint.expectedBodiesReceivedInAnyOrder(commit1, commit2);

    Thread.sleep(1 * 1000);

    mockResultEndpoint.assertIsSatisfied();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:CommitConsumerTest.java


示例20: process

import org.eclipse.egit.github.core.RepositoryCommit; //导入依赖的package包/类
@Override
public void process(Exchange exchange) throws Exception {
    Message in = exchange.getIn();
    RepositoryCommit commit = (RepositoryCommit) in.getBody();
    User author = commit.getAuthor();
    log.debug("Got commit with author: " + author.getLogin() + ": " + author.getHtmlUrl() + " SHA " + commit.getSha());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:CommitConsumerTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NoSuchMethodShim类代码示例发布时间:2022-05-22
下一篇:
Java TextStyle类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap