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


Java Commit类代码示例

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


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

示例1: JiraVersionGenerator

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
public JiraVersionGenerator(JiraService jiraService,
                            Commit releaseCommit,
                            Iterator<Commit> commitIterator,
                            CommitMessageVersionExtractor commitMessageVersionExtractor,
                            Clock clock) {

    this.releaseCommit = releaseCommit;

    this.jiraService = requireNonNull(jiraService);
    this.commitIterator = requireNonNull(commitIterator);
    this.commitMessageVersionExtractor = requireNonNull(commitMessageVersionExtractor);
    this.clock = clock;
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:14,代码来源:JiraVersionGenerator.java

示例2: generate

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
private void generate(String jiraVersionPrefix,
                      ProjectKey projectKey,
                      String versionName) {

    String prefixedVersionName = jiraVersionPrefix + versionName;
    List<Commit> versionCommits = getAllCommitsNewerThanPreviousRelease();

    SerializedVersion version = jiraService.findVersion(projectKey, prefixedVersionName)
            .orElseGet(() -> createNewVersion(projectKey, prefixedVersionName));

    List<IssueKey> issuesSolvedInVersion = getIssueKeys(versionCommits, projectKey);
    jiraService.addVersionToIssues(version.getName(), projectKey, issuesSolvedInVersion);
    LocalDate releaseDate = releaseCommit.getAuthorTimestamp().toInstant().atZone(clock.getZone()).toLocalDate();
    jiraService.releaseVersion(version, releaseDate);
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:16,代码来源:JiraVersionGenerator.java

示例3: getIssueKeys

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
private List<IssueKey> getIssueKeys(Commit commit, ProjectKey projectKey) {

        return Optional.ofNullable(commit.getMessage())
                .map(message -> {
                    Pattern pattern = Pattern.compile(projectKey.getValue() + "-([0-9]+)");
                    Matcher matcher = pattern.matcher(message);
                    List<IssueKey> issueKeys = new ArrayList<>();
                    while (matcher.find()) {
                        issueKeys.add(new IssueKey(projectKey, new IssueId(matcher.group(1))));
                    }
                    return issueKeys;
                }).orElse(Collections.emptyList());
    }
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:14,代码来源:JiraVersionGenerator.java

示例4: getAllCommitsNewerThanPreviousRelease

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
private List<Commit> getAllCommitsNewerThanPreviousRelease() {

        List<Commit> versionCommit = new ArrayList<>();

        while (commitIterator.hasNext()) {
            Commit commit = commitIterator.next();

            if (commitMessageVersionExtractor.extractVersionName(commit.getMessage()).isPresent()) {
                break;
            }

            versionCommit.add(commit);
        }
        return versionCommit;
    }
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:16,代码来源:JiraVersionGenerator.java

示例5: givenJiraVersionGeneratorWithReleaseCommit

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
private void givenJiraVersionGeneratorWithReleaseCommit(Commit commit) {

        jiraVersionGenerator = new JiraVersionGenerator(jiraService,
                commit,
                commitIterator,
                new CommitMessageVersionExtractor("test-project"), clock);
    }
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:8,代码来源:JiraVersionGeneratorTest.java

示例6: givenCommit

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
private Commit givenCommit(String id, String message, LocalDate authorTimestamp) {
    return new SimpleCommit.Builder(id)
            .author(new TestApplicationUser(""))
            .message(message)
            .authorTimestamp(Date.from(authorTimestamp.atStartOfDay().toInstant(ZoneOffset.UTC)))
            .build();
}
 
开发者ID:infobip,项目名称:jira-version-generator,代码行数:8,代码来源:JiraVersionGeneratorTest.java

示例7: check

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
@Override
public void check(RepositoryMergeRequestCheckContext context) {
	final MergeRequest request = context.getMergeRequest();
	final PullRequest pr = request.getPullRequest();
	final Commit prFrom = getChangeSet(pr.getFromRef());
	final Commit prTo = getChangeSet(pr.getToRef());
	final Commit base = mergeBaseResolver.findMergeBase(prFrom, prTo);
    final FileNameHookSetting setting = getSettings(context.getSettings());
    
	final ChangesRequest.Builder builder = new ChangesRequest.Builder(prFrom.getRepository(), prFrom.getId()); 
       if (base.getId() != null) { 
           builder.sinceId(base.getId()); 
       } 
       final ChangesRequest pathsRequest = builder.build(); 
       final ChangedPathsCollector pathsCallback = new ChangedPathsCollector();
       commitService.streamChanges(pathsRequest, pathsCallback);
    Collection<String> filteredFiles = pathsCallback.getChangedPaths();
       filteredFiles = filteredFiles.stream().filter(setting.getIncludePattern().asPredicate()).collect(Collectors.toList());
	 
	if(setting.getExcludePattern().isPresent()) {
		 Pattern excludePattern = setting.getExcludePattern().get();
		 filteredFiles = filteredFiles.stream().filter(excludePattern.asPredicate().negate()).collect(Collectors.toList());
	}
    
    if (filteredFiles.size() > 0) {
        request.veto(i18n.getText("filename-hook.mergecheck.veto", "File Name Hook: The following files violate the file name pattern [{0}]:", setting.getIncludePattern().pattern()), getPullRequestError(filteredFiles));
    }     
}
 
开发者ID:christiangalsterer,项目名称:stash-filehooks-plugin,代码行数:29,代码来源:FileNameHook.java

示例8: findMergeBase

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
Commit findMergeBase(Commit a, Commit b) {
    if (a.equals(b)) {
        return a;
    }
    final GitMergeBaseBuilder builder = builderFactory.builder(a.getRepository()).mergeBase().between(a.getId(), b.getId());
    GitUtils.setAlternateIfCrossRepository(builder, a.getRepository(), b.getRepository(), gitScmConfig);

    final String sha = builder.build(new FirstLineOutputHandler()).call();
    if (sha == null) {
        return null;
    }
    final CommitRequest commitRequest = new CommitRequest.Builder(a.getRepository(), sha).build();

    return commitService.getCommit(commitRequest);
}
 
开发者ID:christiangalsterer,项目名称:stash-filehooks-plugin,代码行数:16,代码来源:MergeBaseResolver.java

示例9: getChangeSet

import com.atlassian.bitbucket.commit.Commit; //导入依赖的package包/类
private Commit getChangeSet(PullRequestRef prRef) {
    final CommitRequest.Builder builder = new CommitRequest.Builder(prRef.getRepository(), prRef.getLatestCommit());
    return commitService.getCommit(builder.build());
}
 
开发者ID:christiangalsterer,项目名称:stash-filehooks-plugin,代码行数:5,代码来源:FileNameHook.java


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