Search in sources :

Example 1 with BulkPatchBuilderRequest

use of jetbrains.buildServer.vcs.BulkPatchService.BulkPatchBuilderRequest in project teamcity-git by JetBrains.

the class BulkPatchBuilderTest method runFullPatch.

private void runFullPatch(@NotNull final VcsRoot root, @NotNull final BulkPatchBuilder patcher) throws VcsException, IOException {
    final List<String> commits = new ArrayList<String>();
    myCommitSupport.collectCommits(root, CheckoutRules.DEFAULT, new CommitsInfoBuilder.CommitsConsumer() {

        public void consumeCommit(@NotNull CommitInfo commit) {
            commits.add(commit.getVersion());
        }
    });
    Assert.assertTrue(commits.size() > 0);
    final List<BulkPatchBuilderRequest> request = new ArrayList<BulkPatchBuilderRequest>();
    String prev = commits.get(0);
    for (final String commit : commits) {
        final String base = prev;
        prev = commit;
        request.add(new BulkPatchBuilderRequest() {

            @Nullable
            public String getFromVersion() {
                return base;
            }

            @NotNull
            public String getToVersion() {
                return commit;
            }

            @Override
            public String toString() {
                return getFromVersion() + "->" + getToVersion();
            }
        });
    }
    myBulkBuilder.buildPatches(root, CheckoutRules.DEFAULT, request, patcher);
}
Also used : ArrayList(java.util.ArrayList) GitCommitsInfoBuilder(jetbrains.buildServer.buildTriggers.vcs.git.commitInfo.GitCommitsInfoBuilder) CommitsInfoBuilder(jetbrains.buildServer.vcs.CommitsInfoBuilder) BulkPatchBuilderRequest(jetbrains.buildServer.vcs.BulkPatchService.BulkPatchBuilderRequest) CommitInfo(jetbrains.vcs.api.CommitInfo) NotNull(org.jetbrains.annotations.NotNull) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ArrayList (java.util.ArrayList)1 GitCommitsInfoBuilder (jetbrains.buildServer.buildTriggers.vcs.git.commitInfo.GitCommitsInfoBuilder)1 BulkPatchBuilderRequest (jetbrains.buildServer.vcs.BulkPatchService.BulkPatchBuilderRequest)1 CommitsInfoBuilder (jetbrains.buildServer.vcs.CommitsInfoBuilder)1 CommitInfo (jetbrains.vcs.api.CommitInfo)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1